To put it simple - what i want is to catch mouse click on a Window blocked by a modal JDialog.
Here is an example:
public class BlockedFrameTest
{
public static void main ( final String[] args )
{
Toolkit.getDefaultToolkit ().addAWTEventListener ( new AWTEventListener ()
{
@Override
public void eventDispatched ( final AWTEvent event )
{
if ( event instanceof MouseEvent )
{
System.out.println ( event );
}
}
}, AWTEvent.MOUSE_EVENT_MASK );
final JFrame frame = new JFrame ( "Frame" );
frame.add ( new JLabel ( "Content" )
{
{
setBorder ( BorderFactory.createEmptyBorder ( 100, 100, 100, 100 ) );
}
} );
frame.pack ();
frame.setLocationRelativeTo ( null );
frame.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
frame.setVisible ( true );
final JDialog dialog = new JDialog ( frame, "Dialog" );
dialog.setModal ( true );
dialog.add ( new JLabel ( "Content" )
{
{
setBorder ( BorderFactory.createEmptyBorder ( 50, 50, 50, 50 ) );
}
} );
dialog.pack ();
dialog.setLocationRelativeTo ( frame );
dialog.setVisible ( true );
}
}
By looking at the example output log you will see that events from JFrame are not passed when JDialog is opened (even into the global AWT event listener added in the example).
So i wonder - is there any way to catch the click on the blocked JFrame?
Or at least catch an event when something blocked is "touched" by user?
The reason why i need this is to make custom-decorated JDialog blick when such event occurs.