public class AWT extends Object
| Modifier and Type | Method and Description |
|---|---|
static Point |
centerOf(Component c)
Returns a point at the center of the given AWT or Swing
Component. |
static Point |
centerOf(Rectangle r)
Returns a point at the center of the given
Rectangle. |
static Point |
centerOfVisibleRect(JComponent c)
Returns a point at the center of the visible rectangle of the given
JComponent. |
static Insets |
insetsFrom(Container c)
Returns the insets of the given AWT or Swing
Container, or an empty one if no insets can be found. |
static Component |
invokerOf(Component c)
Returns the invoker, if any, of the given AWT or Swing
Component; or null, if the Component
is not on a pop-up of any sort. |
static boolean |
isAppletViewer(Component c)
Returns
true if the given component is an Applet viewer. |
static boolean |
isAWTTreeLockHeld()
Indicates whether the AWT Tree Lock is currently held.
|
static boolean |
isHeavyWeightPopup(Component c)
Returns whether the given AWT or Swing
Component is a heavy-weight pop-up, that is, a container for a
JPopupMenu that is implemented with a heavy-weight component (usually an AWT or Swing Window). |
static boolean |
isPointInScreenBoundaries(JComponent c,
Point p)
Indicates whether the given point, relative to the given
JComponent, is inside the screen boundaries. |
static boolean |
isPointInScreenBoundaries(Point p)
Indicates whether the given point is inside the screen boundaries.
|
static boolean |
isSharedInvisibleFrame(Component c)
Returns whether the given component is the default Swing hidden frame.
|
static Point |
locationOnScreenOf(Component c)
Safe version of
Component.getLocationOnScreen, which avoids lockup if an AWT pop-up menu is showing. |
static int |
popupMask() |
static boolean |
popupOnPress()
Returns whether the platform registers a pop-up on mouse press.
|
static Point |
translate(Component c,
int x,
int y)
Translates the given coordinates to the location on screen of the given AWT or Swing
Component. |
static Point |
visibleCenterOf(Component c)
Returns a point at the center of the visible area of the given AWT or Swing
Component. |
public static boolean isPointInScreenBoundaries(@Nonnull JComponent c, @Nonnull Point p)
JComponent, is inside the screen boundaries.c - the given JComponent.p - the point to verify.true if the point is inside the screen boundaries; false otherwise.public static boolean isPointInScreenBoundaries(@Nonnull Point p)
p - the point to verify.true if the point is inside the screen boundaries; false otherwise.@RunsInCurrentThread @Nullable public static Point translate(@Nonnull Component c, int x, int y)
Translates the given coordinates to the location on screen of the given AWT or Swing Component.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
c - the given Component.x - X coordinate.y - Y coordinate.@RunsInEDT @Nonnull public static Point visibleCenterOf(@Nonnull Component c)
Component.c - the given Component.Component.@RunsInCurrentThread @Nonnull public static Point centerOf(@Nonnull Component c)
Returns a point at the center of the given AWT or Swing Component.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
c - the given Component.Component.@RunsInCurrentThread @Nonnull public static Point centerOfVisibleRect(@Nonnull JComponent c)
Returns a point at the center of the visible rectangle of the given JComponent.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
c - the given JComponent.JComponent.@RunsInCurrentThread @Nonnull public static Point centerOf(@Nonnull Rectangle r)
Returns a point at the center of the given Rectangle.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
r - the given Rectangle.Rectangle.@RunsInCurrentThread @Nonnull public static Insets insetsFrom(@Nonnull Container c)
Returns the insets of the given AWT or Swing Container, or an empty one if no insets can be found.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
c - the given Container.Container, or an empty one if no insets can be found.public static boolean isAppletViewer(@Nullable Component c)
true if the given component is an Applet viewer.c - the component to check.true if the given component is an Applet viewer, false otherwise.public static boolean isSharedInvisibleFrame(@Nullable Component c)
c - the component to check.true if the given component is the default hidden frame, false otherwise.@RunsInCurrentThread public static boolean isHeavyWeightPopup(@Nonnull Component c)
Returns whether the given AWT or Swing Component is a heavy-weight pop-up, that is, a container for a
JPopupMenu that is implemented with a heavy-weight component (usually an AWT or Swing Window).
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
c - the given Component.true if the given Component is a heavy-weight pop-up; false otherwise.@RunsInCurrentThread @Nullable public static Component invokerOf(@Nonnull Component c)
Returns the invoker, if any, of the given AWT or Swing Component; or null, if the Component
is not on a pop-up of any sort.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
c - the given Component.Component; or null, if the Component is not on a
pop-up of any sort.@RunsInCurrentThread @Nullable public static Point locationOnScreenOf(@Nonnull Component c)
Safe version of Component.getLocationOnScreen, which avoids lockup if an AWT pop-up menu is showing. The
AWT pop-up holds the AWT tree lock when showing, which lock is required by getLocationOnScreen.
Note: This method is accessed in the current executing thread. Such thread may or may not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
c - the given AWT or Swing Component.Component's top-left corner in the screen's coordinate space, or
null, if the Component is not showing on the screen.public static boolean popupOnPress()
true if the platform registers a pop-up on mouse press, false otherwise.public static int popupMask()
InputEvent mask for the pop-up trigger button.public static boolean isAWTTreeLockHeld()
true if the AWT Tree Lock is currently held, false otherwise.Copyright © 2014 AssertJ. All rights reserved.