Open a new panel via a button Java Swing

Posted by abuteau on Stack Overflow See other posts from Stack Overflow or by abuteau
Published on 2013-11-11T15:41:15Z Indexed on 2013/11/11 15:53 UTC
Read the original article Hit count: 234

Filed under:
|
|

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,

© Stack Overflow or respective owner

Related posts about java

Related posts about swing