0

大家好,这里只需要一点帮助:

            JComboBox comboBox = new JComboBox();
        comboBox.setModel(new DefaultComboBoxModel(new String[] {"Select", "Single", "Twin", "Double", "Suit", "Conference"}));


        String[] single = d.getAvaSinglelist().toArray(new String[d.getAvaSinglelist().size()]);
        String[] Dbroon = d.getAvaDoublelist().toArray(new String[d.getAvaDoublelist().size()]);
        String[] Twin = d.getAvaTwinlist().toArray(new String[d.getAvaTwinlist().size()]);
        String[] Suit = d.getAvaSuitslist().toArray(new String[d.getAvaSuitslist().size()]);
        String[] conf = d.getAvaConferencelist().toArray(new String[d.getAvaConferencelist().size()]);
        JComboBox comboBox_1 = new JComboBox();

            if(comboBox.getSelectedItem().equals("Single")){
                comboBox_1.setModel(new DefaultComboBoxModel(single));
            }

            if(comboBox.getSelectedItem().equals("Twin")){
                comboBox_1.setModel(new DefaultComboBoxModel(Dbroon));
            }
            if(comboBox.getSelectedItem().equals("Double")){
                comboBox_1.setModel(new DefaultComboBoxModel(Twin));
            }
            if(comboBox.getSelectedItem().equals("Suit")){
                comboBox_1.setModel(new DefaultComboBoxModel(Suit));
            }
            if(comboBox.getSelectedItem().equals("Conference")){
                comboBox_1.setModel(new DefaultComboBoxModel(conf));
            }

所以我想做什么并且无法找出如何在动态模式下根据第一个组合框的选定项目刷新第二个组合框,但正如你们所看到的,我不知道每个提示都是受欢迎的

4

1 回答 1

3

在您ActionListener的第一个JComboBox. 然后在该代码中添加用于更新第二个组合框的逻辑。

于 2013-01-22T20:51:04.560 回答