I am using netbeans to create a GUI for a tool I am working on. The tools contents are contained in a class that extends JPanel and has a button. When I click the button, I want a window to pop up which will have additional buttons and options, the contents of which are defined in another class that also extends JPanel. How can I accomplish this?
Simplified code of main class. I removed all the code that is not important to this problem:
public class FirstPanel extends JPanel {
private JButton myButton;
public FirstPanel() {
myButton = new JButton("Button");
myButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
// TO DO
}
});
}
}
And then my second class would look similar, and be in charge of handling all of its buttons and such. How can I accomplish this?