开发者

Make a selection in one jcombobox enable a different jcombobox

I have 7 jcomboboxes that all start with the same default selection. How do I make then next one enabled when something other than 开发者_如何学运维the default if selected in the preceding jcombobox?

        if ( ! (custData1.equals("Please Select a Customer from the dropdown menu")) ){
        custData2.setEnabled(true);
        if ( ! (custData2.equals("Please Select a Customer from the dropdown menu")) ){
            custData3.setEnabled(true);
            if ( ! (custData3.equals("Please Select a Customer from the dropdown menu")) ){
            custData4.setEnabled(true);
            if ( ! (custData4.equals("Please Select a Customer from the dropdown menu")) ){
            custData5.setEnabled(true);
            if ( ! (custData5.equals("Please Select a Customer from the dropdown menu")) ){
            custData6.setEnabled(true);
            if ( ! (custData6.equals("Please Select a Customer from the dropdown menu")) ){
            custData7.setEnabled(true);
            }
           }
          }
         }
        }
    }

This doesn't seem to work...


Create a custom JComboBox by extends JComboBox. Make that class take in a reference to the preceding combobox. Have it and itself as an ActionListener to the preceding box and whenever an item is selected it should enable/disable itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜