Java 在一个jcombobox中进行选择启用不同的jcombobox
我有7个JComboxes,它们都以相同的默认选择开始。如果在前面的jcombobox中选择了默认值以外的值,如何启用下一个Java 在一个jcombobox中进行选择启用不同的jcombobox,java,swing,jcombobox,Java,Swing,Jcombobox,我有7个JComboxes,它们都以相同的默认选择开始。如果在前面的jcombobox中选择了默认值以外的值,如何启用下一个 if ( ! (custData1.equals("Please Select a Customer from the dropdown menu")) ){ custData2.setEnabled(true); if ( ! (custData2.equals("Please Select a Customer from
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);
}
}
}
}
}
}
这似乎不起作用…通过extends
JComboBox
创建一个自定义的JComboBox
。使该类引用前面的组合框。将它和它本身作为ActionListener
添加到前面的框中,无论何时选择一个项目,它都应该启用/禁用它自己