62,614
社区成员
发帖
与我相关
我的任务
分享
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JFrame;
public class Try extends JFrame {
public Try() {
super("");
this.setBounds(100, 100, 200, 200);
this.setLayout(null);
String[]s={"1","2","3"};
ComboBoxModel cmb=new DefaultComboBoxModel(s);
JComboBox box=new JComboBox(cmb);
box.setBounds(10,20,100,30);
this.add(box);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[]args){
new Try();
}
}