日期:2014-05-20 浏览次数:20668 次
public class Test3 extends JFrame{ private JTextField textField; public Test3() { getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JComboBox comboBox = new JComboBox(new String[]{"1","2","3"}); // comboBox.setSize(new Dimension(60,10));//doesn't work getContentPane().add(comboBox); textField = new JTextField(); textField.setSize(100,50);//do not work either getContentPane().add(textField); textField.setColumns(10); this.pack(); this.setVisible(true); } public static void main(String...args){ new Test3(); } }