posted 18 years ago
You can use a JLayeredPane or a glassPane for this. The tutorial has a demonstration app for each on the page 'How to Use Root Panes'. See the JRootPane api for more about glassPanes. At the top of the (api) page there is a link into the tutorial to the root pane page.
For hand–made work an easy way is to mount a non–opaque JPanel over the parent panel with an OverlayLayout and use it for the mouse code. It will, of course, restrict access to the parent panel. But it has the advantage of covering only the parent panel, unlike a glassPane, leaving other ui components in the clear. One way to put this together: