diff options
Diffstat (limited to 'libjava/classpath/javax/swing/SwingUtilities.java')
-rw-r--r-- | libjava/classpath/javax/swing/SwingUtilities.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/libjava/classpath/javax/swing/SwingUtilities.java b/libjava/classpath/javax/swing/SwingUtilities.java index 5d02d9bb396..ccd37d03a55 100644 --- a/libjava/classpath/javax/swing/SwingUtilities.java +++ b/libjava/classpath/javax/swing/SwingUtilities.java @@ -1045,8 +1045,7 @@ public class SwingUtilities */ public static boolean isLeftMouseButton(MouseEvent event) { - return ((event.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) - == InputEvent.BUTTON1_DOWN_MASK); + return ((event.getModifiers() & InputEvent.BUTTON1_MASK) != 0); } /** @@ -1599,4 +1598,27 @@ public class SwingUtilities throw new IllegalArgumentException("Unrecognised code: " + code); } } + + /** + * Converts a rectangle in the coordinate system of a child component into + * a rectangle of one of it's Ancestors. The result is stored in the input + * rectangle. + * + * @param comp the child component + * @param r the rectangle to convert + * @param ancestor the ancestor component + */ + static void convertRectangleToAncestor(Component comp, Rectangle r, + Component ancestor) + { + if (comp == ancestor) + return; + + r.x += comp.getX(); + r.y += comp.getY(); + + Component parent = comp.getParent(); + if (parent != null && parent != ancestor) + convertRectangleToAncestor(parent, r, ancestor); + } } |