Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/06/2010, 16:10
tazzwt
 
Fecha de Ingreso: marzo-2010
Mensajes: 432
Antigüedad: 14 años, 1 mes
Puntos: 11
setBounds no me funciona.

Tengo cun Jcombobox pero me ocupa todo el frame, como puedo dimensionar el Jcombobox para que ocupe menos espacio.

Código Java:
Ver original
  1. import javax.swing.JFrame;
  2. import java.awt.FlowLayout;
  3. import java.awt.HeadlessException;
  4.  
  5. import javax.swing.JCheckBox;
  6. import javax.swing.JComboBox;
  7.  
  8. public class seleccion {
  9.   public static void main(String[] args) {
  10.     JFrame frame = new JFrame("Titulo");
  11.  
  12.     int alto = 200;
  13.     int ancho = 350;
  14.     frame.setBounds(400, 300, ancho, alto);
  15.  
  16.     JComboBox jComboBox1 = new JComboBox();
  17.  
  18.     jComboBox1.addItem("Cotton");
  19.     jComboBox1.addItem("Lima");
  20.     jComboBox1.addItem("Limon");
  21.     jComboBox1.addItem("Naranja");
  22.     jComboBox1.addItem("Manzana");
  23.     jComboBox1.addItem("Prueba");
  24.  
  25.     jComboBox1.setBounds(20, 20, 10, 10);
  26.  
  27.     frame.add(jComboBox1);
  28.  
  29.     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  30.     frame.setVisible(true);
  31.   }
  32. }