Bad event on java panel

Posted by LucaB on Stack Overflow See other posts from Stack Overflow or by LucaB
Published on 2010-05-18T13:15:51Z Indexed on 2010/05/18 15:10 UTC
Read the original article Hit count: 304

Filed under:
|
|
|

Hi I have a java panel with 4 buttons. When I click on of these buttons, a new frame appears and the first is hidden with setVisibile(false). On that new window, I have another button, but when i click it, I got the event corresponding to the fourth button of the first window. Clicking the button again does the trick, but of course this is not acceptable. Am I missing something? I just show the frames with

nameOfTheFrame.setVisible(true);

and I have MouseListeners on every button.

The code of the last button is simply:

System.exit(0);

EDIT

Sample code:

    private void btn_joinGamePressed(java.awt.event.MouseEvent evt) {
            GraphicsTools.getInstance().getCreateGame().setVisible(false);
            GraphicsTools.getInstance().getMainPanel().setVisible(false);
            GraphicsTools.getInstance().getRegistration().setVisible(true);
}

GraphicsTools is a Singleton.

© Stack Overflow or respective owner

Related posts about java

Related posts about jframe