62,614
社区成员
发帖
与我相关
我的任务
分享
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();
}
}