boolean inButton = false;
boolean inMenuBar = false;
Point glassPanePoint = e.getPoint();
Component component = null;
Container container = contentPane;
Point containerPoint = SwingUtilities.convertPoint(this, glassPanePoint,
contentPane);
int eventID = e.getID();
if (containerPoint.y < 0) {
inMenuBar = true;
container = menuBar;
containerPoint = SwingUtilities.convertPoint(this, glassPanePoint,
menuBar);
testForDrag(eventID);
}
//XXX: If the event is from a component in a popped-up menu,
//XXX: then the container should probably be the menu's
//XXX: JPopupMenu, and containerPoint should be adjusted
//XXX: accordingly.
component = SwingUtilities.getDeepestComponentAt(container,
containerPoint.x,
containerPoint.y);
if (component == null) {
return;
}
else {
inButton = true;
testForDrag(eventID);
}
if (inMenuBar || inButton || inDrag) {
Point componentPoint = SwingUtilities.convertPoint(this, glassPanePoint,
component);
component.dispatchEvent(new MouseEvent(component,
eventID,
e.getWhen(),
e.getModifiers(),
componentPoint.x,
componentPoint.y,
e.getClickCount(),
e.isPopupTrigger()));
}