package First;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.Border;
class Win{
void go(){
JFrame jf=new JFrame("下拉组合框");
String[] ItemList1 = { "item1", "item2", "item4", "item5", "item6", "item7" };
JComboBox<?> ComboBox1 = new JComboBox<Object>(ItemList1);// 添加一个下拉组合框
JPanel panel3=new JPanel();//面板容器
panel3.add(ComboBox1);
ComboBox1.setEditable(true);
Border etched5 = BorderFactory.createEtchedBorder();
Border border5 = BorderFactory.createTitledBorder(etched5, "下拉");
panel3.setBorder(border5);
jf.add(panel3);
jf.setBounds(500,400,500,200);
jf.setVisible(true);//使JFrame能显示出来
}
}
public class sir{
public static void main(String[] args){
new Win().go();
}
}
Java下拉组合框
最新推荐文章于 2022-04-20 23:32:30 发布