Open a new panel via a button Java Swing
- by abuteau
I saw a lot of post on StackOverflow relating to this, but unable to solve my problem.
I want to open a new Panel by clicking a button.
Here is how i try to do it
parameterButton = new JButton("Parametres");
parameterButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
createParameterPanel = new DisplayParameterPanel();
createParameterPanel.setVisible(true);
add(createParameterPanel);
};
});
add(parameterButton);
When I click the parameterButton it doesn't open.
How can I open a new panel.
Thanks,