Hi, you need to redispatch the mouse events to the underlying components…
If I remeber well this method come from the java tutorial…
private void redispatchMouseEvent(MouseEvent e)
{
Point glassPanePoint = e.getPoint();
Container container = frame.getContentPane();
Point containerPoint = SwingUtilities.convertPoint(
this,
glassPanePoint,
container);
if (containerPoint.y >= 0)
{
Component component =
SwingUtilities.getDeepestComponentAt(
container,
containerPoint.x,
containerPoint.y);
// TODO : Remove this, test only
if( component instanceof JPanel )
{
frame.requestFocus();
}
// END remove
if ((component != null) )
{
Point componentPoint = SwingUtilities.convertPoint(
this,
glassPanePoint,
component);
component.dispatchEvent(new MouseEvent(component,
e.getID(),
e.getWhen(),
e.getModifiers(),
componentPoint.x,
componentPoint.y,
e.getClickCount(),
e.isPopupTrigger()));
}
}
}
It may still remains some problems depending on what kind of components you have under you glasspane… I think that if you want rollover buttons you have to implement the
public void eventDispatched(AWTEvent event )
method from
AWTEventListener
interface.