|
|
@ -197,40 +197,23 @@ public class MouseEventUI<V extends JComponent> extends AbstractLayerUI<V> { |
|
|
|
Point point = mouseEvent.getPoint(); |
|
|
|
Point point = mouseEvent.getPoint(); |
|
|
|
SwingUtilities.convertPointToScreen(point, mouseEvent.getComponent()); |
|
|
|
SwingUtilities.convertPointToScreen(point, mouseEvent.getComponent()); |
|
|
|
SwingUtilities.convertPointFromScreen(point, layer); |
|
|
|
SwingUtilities.convertPointFromScreen(point, layer); |
|
|
|
/* |
|
|
|
|
|
|
|
* Removed the contains check because it results in jumping when |
|
|
|
|
|
|
|
* dragging internal frames in a desktop pane and dragging outside the |
|
|
|
|
|
|
|
* boundaries of the desktop. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Introduced this check to solve some scrolling problem, but don't |
|
|
|
|
|
|
|
* quite remember the specifics. Maybe that problem is gone by other |
|
|
|
|
|
|
|
* changes. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
// Rectangle layerBounds = layer.getBounds();
|
|
|
|
|
|
|
|
// Container parent = layer.getParent();
|
|
|
|
|
|
|
|
// Rectangle parentRectangle = new Rectangle(-layerBounds.x,
|
|
|
|
|
|
|
|
// -layerBounds.y, parent.getWidth(), parent.getHeight());
|
|
|
|
|
|
|
|
// if (parentRectangle.contains(point)) {
|
|
|
|
|
|
|
|
return transformPoint(layer, point); |
|
|
|
return transformPoint(layer, point); |
|
|
|
// } else {
|
|
|
|
|
|
|
|
// return new Point(-1, -1);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private MouseWheelEvent createMouseWheelEvent(final MouseWheelEvent mouseWheelEvent, final Point point, |
|
|
|
private MouseWheelEvent createMouseWheelEvent(final MouseWheelEvent mouseWheelEvent, final Point point, |
|
|
|
final Component target) { |
|
|
|
final Component target) { |
|
|
|
return new MouseWheelEvent(target, //
|
|
|
|
return new MouseWheelEvent(target, |
|
|
|
mouseWheelEvent.getID(), //
|
|
|
|
mouseWheelEvent.getID(), |
|
|
|
mouseWheelEvent.getWhen(), //
|
|
|
|
mouseWheelEvent.getWhen(), |
|
|
|
mouseWheelEvent.getModifiersEx(), //
|
|
|
|
mouseWheelEvent.getModifiersEx(), |
|
|
|
point.x, //
|
|
|
|
point.x, |
|
|
|
point.y, //
|
|
|
|
point.y, |
|
|
|
mouseWheelEvent.getClickCount(), //
|
|
|
|
mouseWheelEvent.getClickCount(), |
|
|
|
mouseWheelEvent.isPopupTrigger(), //
|
|
|
|
mouseWheelEvent.isPopupTrigger(), |
|
|
|
mouseWheelEvent.getScrollType(), //
|
|
|
|
mouseWheelEvent.getScrollType(), |
|
|
|
mouseWheelEvent.getScrollAmount(), //
|
|
|
|
mouseWheelEvent.getScrollAmount(), |
|
|
|
mouseWheelEvent.getWheelRotation() //
|
|
|
|
mouseWheelEvent.getWheelRotation()); |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void dispatchMouseEvent(final MouseEvent mouseEvent) { |
|
|
|
private void dispatchMouseEvent(final MouseEvent mouseEvent) { |
|
|
@ -300,8 +283,6 @@ public class MouseEventUI<V extends JComponent> extends AbstractLayerUI<V> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("Duplicates") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Component getMouseMotionListeningComponent(final Component component) { |
|
|
|
private Component getMouseMotionListeningComponent(final Component component) { |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Mouse motion events may result in MOUSE_ENTERED and MOUSE_EXITED. |
|
|
|
* Mouse motion events may result in MOUSE_ENTERED and MOUSE_EXITED. |
|
|
@ -340,10 +321,8 @@ public class MouseEventUI<V extends JComponent> extends AbstractLayerUI<V> { |
|
|
|
if (view == null) { |
|
|
|
if (view == null) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Point viewPoint = SwingUtilities.convertPoint(layer, targetPoint, |
|
|
|
Point viewPoint = SwingUtilities.convertPoint(layer, targetPoint, view); |
|
|
|
view); |
|
|
|
return SwingUtilities.getDeepestComponentAt(view, viewPoint.x, viewPoint.y); |
|
|
|
return SwingUtilities.getDeepestComponentAt(view, viewPoint.x, |
|
|
|
|
|
|
|
viewPoint.y); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -417,14 +396,14 @@ public class MouseEventUI<V extends JComponent> extends AbstractLayerUI<V> { |
|
|
|
Point newPoint = new Point(targetPoint); |
|
|
|
Point newPoint = new Point(targetPoint); |
|
|
|
SwingUtilities.convertPointToScreen(newPoint, layer); |
|
|
|
SwingUtilities.convertPointToScreen(newPoint, layer); |
|
|
|
SwingUtilities.convertPointFromScreen(newPoint, target); |
|
|
|
SwingUtilities.convertPointFromScreen(newPoint, target); |
|
|
|
return new MouseEvent(target, //
|
|
|
|
return new MouseEvent(target, |
|
|
|
id, //
|
|
|
|
id, |
|
|
|
mouseEvent.getWhen(), //
|
|
|
|
mouseEvent.getWhen(), |
|
|
|
mouseEvent.getModifiersEx(), //
|
|
|
|
mouseEvent.getModifiersEx(), |
|
|
|
newPoint.x, //
|
|
|
|
newPoint.x, |
|
|
|
newPoint.y, //
|
|
|
|
newPoint.y, |
|
|
|
mouseEvent.getClickCount(), //
|
|
|
|
mouseEvent.getClickCount(), |
|
|
|
mouseEvent.isPopupTrigger(), //
|
|
|
|
mouseEvent.isPopupTrigger(), |
|
|
|
mouseEvent.getButton()); |
|
|
|
mouseEvent.getButton()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|