I have 2 panels. The first panel has a combo box. depending on the value of the item in the combobox selected, a panel below it must change. in the action listener of the combo box, when I try to change the panel, it does not change. Why is this?
cb1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String s = (String) cb1.getSelectedItem();
if (s.equals("Invoice")) {
panel3Customizera();
g.gridy = 2;
remove(panel3);
add(panel3, g);
} else {
panel3Customizerb();
g.gridy = 2;
add(panel3, g);
}
}
});
panel3customizer's add elements into panel3.panel 3 is added to a jframe. The link to the entire code can be found here