2
在我的代碼中,如果用戶選擇了Production,則可用的頻道會發生變化,但如果用戶決定選擇'Staging'或'Test',則應顯示頻道的完整列表。發生這種情況時,顯示的是[Ljava.lang.String;@1c23f1bb
。什麼會糾正這種行爲?我是java的newby。將JCombobox值返回到'原始'列表
以下是我的代碼,當我將environmentCbx設置爲「Production」以外的內容時,我在社區組合框中沒有獲得原始字符串數組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);
}