Would someone be so kind as to explain why the following happens?
I have a fullscreen JFrame. I have a cheesy render loop (this is the MultiBufferTest code found on Sun's site) that switches colors.
I added a JButton to the content pane of the JFrame. It works. Its job is to pop open a dialog box.
The dialog box does NOT open, but! If i use the following code i can see it:
1 2 3 4 5 6 7 8 9
| mainFrame.getContentPane().paintComponents( g ); if ( dialog.isVisible() ) { dialog.paintComponents( g ); dialog.toFront(); } bufferStrategy.show(); g.dispose(); |
Now the funny thing is this - if the dialog is showing, the mouse doesn't do a damn thing over it. But if you hit the SPACE bar, the actionPerformed() listener method that is attached to the only button in the dialog box (essentially a BIG cancel button) fires.
Why won't the mouse trigger over the dialog box? I even tried adding a MouseListener to the dialog boxes button... to no avail.
This answer might also help Breakfast out, as he has a similar question.