Just had a quick question about my code. Seems like a very simple solution, perhaps I'm just too sleepy to think straight.
What I am wanting to do is if a certain index is selected in my combobox i want certain textfields to display which is apparent by the code:
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
if (jComboBox1.getSelectedIndex == 0) {
aTextField.setVisible(true);
}
else if (jComboBox1.getSelectedIndex == 1) {
aTextField.setVisible(true);
bTextField.setVisible(true);
}
else if (jComboBox1.getSelectedIndex == 2) {
aTextField.setVisible(true);
bTextField.setVisible(true);
cTextField.setVisible(true);
}
else if (jComboBox1.getSelectedIndex == 3) {
aTextField.setVisible(true);
bTextField.setVisible(true);
cTextField.setVisible(true);
dTextField.setVisible(true);
}
else if (jComboBox1.getSelectedIndex == 4) {
aTextField.setVisible(true);
bTextField.setVisible(true);
cTextField.setVisible(true);
dTextField.setVisible(true);
eTextField.setVisible(true);
}
else if (jComboBox1.getSelectedIndex == 5) {
aTextField.setVisible(true);
bTextField.setVisible(true);
cTextField.setVisible(true);
dTextField.setVisible(true);
eTextField.setVisible(true);
fTextField.setVisible(true);
}
else if (jComboBox1.getSelectedIndex == 6) {
aTextField.setVisible(true);
bTextField.setVisible(true);
cTextField.setVisible(true);
dTextField.setVisible(true);
eTextField.setVisible(true);
fTextField.setVisible(true);
gTextField.setVisible(true);
}
else if (jComboBox1.getSelectedIndex == 7) {
aTextField.setVisible(true);
bTextField.setVisible(true);
cTextField.setVisible(true);
dTextField.setVisible(true);
eTextField.setVisible(true);
fTextField.setVisible(true);
gTextField.setVisible(true);
hTextField.setVisible(true);
}
else if (jComboBox1.getSelectedIndex == 8) {
aTextField.setVisible(true);
bTextField.setVisible(true);
cTextField.setVisible(true);
dTextField.setVisible(true);
eTextField.setVisible(true);
fTextField.setVisible(true);
gTextField.setVisible(true);
hTextField.setVisible(true);
iTextField.setVisible(true);
}
else (jComboBox1.getSelectedIndex == 9) {
aTextField.setVisible(true);
bTextField.setVisible(true);
cTextField.setVisible(true);
dTextField.setVisible(true);
eTextField.setVisible(true);
fTextField.setVisible(true);
gTextField.setVisible(true);
hTextField.setVisible(true);
iTextField.setVisible(true);
jTextField.setVisible(true);
}
}
Perhaps I'm just not paying attention close enough, but shouldn't that code work?