I'm having a bit of trouble changing the neccessary buttons in my program as it is running.
I can add, and remove them just fine in the Jpanel's constructor, but I can't seem to in any methods outside of the constructor. Is this just how buttons work? I assumed that they work like other listeners and that I can call them at any time.
For example, here's how I have a button created in my JPanel's constructor.
someButton = new JButton("something");
add(someButton);
someButton.setActionCommand("something");
someButton.addActionListener(this);
This works fine in the constructor. When the class is called, it has a shiny button. But, I have some other buttons that I need to bring up, only at certain times, within this JPanel. I tried to do it the same way. First by putting that exact code in it's own method. But it failed to do anything, during run time. I know these conditions are being met and that the method itself is being called, as that was the first thing I checked.
What am I missing about the way buttons work?