345 |
* @see #calculateInnerArea |
* @see #calculateInnerArea |
346 |
*/ |
*/ |
347 |
public static Rectangle calculateInsetArea(Rectangle base, Insets insets, |
public static Rectangle calculateInsetArea(Rectangle base, Insets insets, |
348 |
Rectangle ret) |
Rectangle ret) |
349 |
{ |
{ |
350 |
if (ret == null) |
if (ret == null) |
351 |
ret = new Rectangle(); |
ret = new Rectangle(); |
570 |
* @param destination The component which the return value will be |
* @param destination The component which the return value will be |
571 |
* expressed in terms of |
* expressed in terms of |
572 |
* |
* |
573 |
* @return The point <code>(x,y)</code> converted from the coordinate space of the |
* @return The point <code>(x,y)</code> converted from the coordinate |
574 |
|
* space of the |
575 |
* source component to the coordinate space of the destination component |
* source component to the coordinate space of the destination component |
576 |
* |
* |
577 |
* @see #convertPointToScreen |
* @see #convertPointToScreen |
580 |
* @see #getRoot |
* @see #getRoot |
581 |
*/ |
*/ |
582 |
public static Point convertPoint(Component source, int x, int y, |
public static Point convertPoint(Component source, int x, int y, |
583 |
Component destination) |
Component destination) |
584 |
{ |
{ |
585 |
Point pt = new Point(x, y); |
Point pt = new Point(x, y); |
586 |
|
|
623 |
* @see #convertPoint |
* @see #convertPoint |
624 |
* @see #getRoot |
* @see #getRoot |
625 |
*/ |
*/ |
626 |
public static Rectangle convertRectangle(Component source, |
public static Rectangle convertRectangle(Component source, Rectangle rect, |
627 |
Rectangle rect, |
Component destination) |
|
Component destination) |
|
628 |
{ |
{ |
629 |
Point pt = convertPoint(source, rect.x, rect.y, destination); |
Point pt = convertPoint(source, rect.x, rect.y, destination); |
630 |
return new Rectangle(pt.x, pt.y, rect.width, rect.height); |
return new Rectangle(pt.x, pt.y, rect.width, rect.height); |
650 |
* @see #convertPoint |
* @see #convertPoint |
651 |
*/ |
*/ |
652 |
public static MouseEvent convertMouseEvent(Component source, |
public static MouseEvent convertMouseEvent(Component source, |
653 |
MouseEvent sourceEvent, |
MouseEvent sourceEvent, |
654 |
Component destination) |
Component destination) |
655 |
{ |
{ |
656 |
Point newpt = convertPoint(source, sourceEvent.getX(), sourceEvent.getY(), |
Point newpt = convertPoint(source, sourceEvent.getX(), sourceEvent.getY(), |
657 |
destination); |
destination); |
658 |
|
|
659 |
return new MouseEvent(destination, sourceEvent.getID(), |
return new MouseEvent(destination, sourceEvent.getID(), |
660 |
sourceEvent.getWhen(), sourceEvent.getModifiers(), |
sourceEvent.getWhen(), sourceEvent.getModifiers(), |
661 |
newpt.x, newpt.y, sourceEvent.getClickCount(), |
newpt.x, newpt.y, sourceEvent.getClickCount(), |
662 |
sourceEvent.isPopupTrigger(), sourceEvent.getButton()); |
sourceEvent.isPopupTrigger(), |
663 |
|
sourceEvent.getButton()); |
664 |
} |
} |
665 |
|
|
666 |
|
|