分辨率测试图:java中jcombobox能否更新数组

来源:百度文库 编辑:神马品牌网 时间:2024/04/30 02:13:29
String str1[]=new String[5];
String str2[]=new String[5];
JComboBox jComB=new JComboBox(str1);
上述程序是把下拉列表jComB关联到str1,请问做完如上操作后如何让下拉列表jComB关联到str2?

4月8日 18:16 getSelectedItem()返回的是Object所以你可以这样
Integer.parseInt(getSelectedItem().toString()) //这里toString()是把Object变成String类型的