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
. |
static Point |
centerOf(Rectangle r)
Returns a point at the center of the given
. |
static Point |
centerOfVisibleRect(JComponent c)
Returns a point at the center of the visible rectangle of the given
. |
static Insets |
insetsFrom(Container c)
Returns the insets of the given
, or an empty one if no insets can be found. |
static Component |
invokerOf(Component c)
Returns the invoker, if any, of the given
; 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
Component is a heavy-weight pop-up, that is, a container for a
JPopupMenu that is implemented with a heavy-weight component (usually a 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
, which avoids lockup if an AWT pop-up menu is
showing. |
static Window[] |
ownerLessWindows()
Returns an array of all
s that have no owner. |
static int |
popupMask()
Returns the
mask for the pop-up trigger button. |
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
. |
static Point |
visibleCenterOf(Component c)
Returns a point at the center of the visible area of the given
. |
public static boolean isPointInScreenBoundaries(JComponent c, 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(Point p)
p
- the point to verify.true
if the point is inside the screen boundaries; false
otherwise.public static Window[] ownerLessWindows()
Window
s that have no owner. They include Frame
s
and ownerless Dialog
s and Window
s.
This method only works when using JDK 1.6 or later. For JDK 1.5, this method returns an empty array.
Window
s that have no owner.@RunsInCurrentThread public static Point translate(Component c, int x, int y)
Component
.
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
c
- the given Component
.x
- X coordinate.y
- Y coordinate.@RunsInEDT public static Point visibleCenterOf(Component c)
Component
.c
- the given Component
.Component
.@RunsInCurrentThread public static Point centerOf(Component c)
Component
.
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
c
- the given Component
.Component
.@RunsInCurrentThread public static Point centerOfVisibleRect(JComponent c)
JComponent
.
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
c
- the given JComponent
.JComponent
.@RunsInCurrentThread public static Point centerOf(Rectangle r)
Rectangle
.
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
r
- the given Rectangle
.Rectangle
.@RunsInCurrentThread public static Insets insetsFrom(Container c)
Container
, or an empty one if no insets can be found.
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
c
- the given Container
.Container
, or an empty one if no insets can be found.public static boolean isAppletViewer(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(Component c)
c
- the component to check.true
if the given component is the default hidden frame, false
otherwise.@RunsInCurrentThread public static boolean isHeavyWeightPopup(Component c)
Component
is a heavy-weight pop-up, that is, a container for a
JPopupMenu
that is implemented with a heavy-weight component (usually a Window
).
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
c
- the given Component
.true
if the given Component
is a heavy-weight pop-up; false
otherwise.@RunsInCurrentThread public static Component invokerOf(Component c)
Component
; or null
, if the
Component
is not on a pop-up of any sort.
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling 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 public static Point locationOnScreenOf(Component c)
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 not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
c
- the given 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.InputEvent
mask for the pop-up trigger button.public static boolean isAWTTreeLockHeld()
true
if the AWT Tree Lock is currently held, false
otherwise.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.