public class MoreSwingUtilities extends Object
| Modifier and Type | Method and Description |
|---|---|
static Rectangle |
asRectangle(Rectangle2D rectangle)
Converts the given Rectangle2D into a Rectangle by casting all
elements to
int. |
static MouseEvent |
convertMouseEvent(Component source,
MouseEvent sourceEvent,
Component destination)
Implementation of
SwingUtilities.convertMouseEvent(
Component, MouseEvent, Component) that properly sets the
button of the returned event. |
static Point |
convertPoint(Component sourceComponent,
Point2D point,
Component targetComponent)
Wrapper for
SwingUtilities#convertPoint that accepts
a Point2D and not only a Point. |
static void |
invokeOnEventDispatchThread(Runnable runnable)
Execute the given runnable on the event dispatch thread.
|
static void |
invokeOnEventDispatchThreadSync(Runnable runnable)
Execute the given runnable on the event dispatch thread.
|
public static Rectangle asRectangle(Rectangle2D rectangle)
int.rectangle - The rectanglepublic static Point convertPoint(Component sourceComponent, Point2D point, Component targetComponent)
SwingUtilities#convertPoint that accepts
a Point2D and not only a Point. (The Point2D is internally converted
into a Point by casting all components to int)sourceComponent - The source componentpoint - The pointtargetComponent - The target componentpublic static MouseEvent convertMouseEvent(Component source, MouseEvent sourceEvent, Component destination)
SwingUtilities.convertMouseEvent(
Component, MouseEvent, Component) that properly sets the
button of the returned event.
(See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7181403 )source - The source componentsourceEvent - The source eventdestination - The destination componentpublic static void invokeOnEventDispatchThread(Runnable runnable)
SwingUtilities.invokeLaterrunnable - The runnablepublic static void invokeOnEventDispatchThreadSync(Runnable runnable)
SwingUtilities.invokeAndWaitrunnable - The runnableRuntimeException - If the given runnable causes a RuntimeExceptionCopyright © 2022. All rights reserved.