Studyon Minte9.com
Java SE




JComboBox



Combox Size

package testexample; import java.awt.Dimension; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; public class Test extends JFrame { public static void main(String[] args) { JFrame frame = new Test(); frame.setBounds(200, 200, 300, 200); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setVisible(true); } public Test() { JComboBox comboBox = new JComboBox( new Object[] {"Movie 1", "Movie 2"} ); comboBox.setPreferredSize(new Dimension(200, 27)); // --- Look Here --- // // Without this line, with is minim JPanel panel = new JPanel(); panel.add(comboBox); add(panel); } }
 


http://www.javabeginner.com/java-swing/java-jcombobox-class-example