在我的代码中,如果用户选择生产,则可用的频道会更改,但如果用户决定选择“暂存”或“测试”,则应显示完整的频道列表。当这种情况发生时,显示的是[Ljava.lang.String;@1c23f1bb
相反的。什么会纠正这种行为?我是java新手。
下面是我的代码,当我将 environmentCbx 设置为“生产”以外的其他内容时,我没有communityNameString
在社区组合框中获得原始字符串数组。
String communityNameString[] = {"Connection","CDK","Governors", "Community", "Committee", "Center","All States","Community_2","Sandbox"};
environmentCbx.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae) {
JComboBox environmentCbx = (JComboBox)ae.getSource();
String environmentName = (String)environmentCbx.getSelectedItem();
if("Production".equals(environmentName))
{
communityCbx.removeAllItems();
//communityCbx.addItem(productionCommunityNames);
communityCbx.addItem("Associate");
}
else
{
communityCbx.removeAllItems();
communityCbx.addItem(communityNameString);
}