|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object abbot.util.AWT
public class AWT
Various AWT utilities to facilitate component-oriented operations.
Nested Class Summary | |
---|---|
static interface |
AWT.ComponentPredicate
|
Field Summary | |
---|---|
static String |
CONTAINS_HEAVYWEIGHT_COMPONENT
Set this client property on components which contain a heavyweight component. |
static Point |
DEFAULT_CASCADE
Offset from the position of the currently active window to the position of a new window. |
static int |
POPUP_TIMEOUT
|
(package private) static String |
ROOT_FRAME_CLASSNAME
|
Method Summary | |
---|---|
static Color |
alpha(Color c,
int alpha)
Return a copy of the given color with a new alpha component. |
static void |
cascade(Window w)
Cascade the given window based on the currently active Frame . |
static void |
cascade(Window w,
int xoff,
int yoff)
Cascade the given window based on the currently active Frame . |
static void |
centerOnFrame(Window window,
Frame frame)
Center on the specified frame. |
static void |
centerOnScreen(Window window)
Center the given Window on the default screen. |
static Color |
combine(Color c1,
Color c2)
Combine the two colors with equal weight. |
static Color |
combine(Color c1,
Color c2,
float weight)
Combine the two colors, giving the requested weight to the first. |
static boolean |
containsFocus(Component c)
Return whether the given component either has focus or is the ancestor of the focused component. |
static void |
dismissAWTPopup()
Ensure any extant AWT popup is dismissed. |
static void |
ensureOnScreen(Window w)
Ensure the given window is visible on screen. |
static boolean |
eventTypeEnabled(Component c,
int id)
WARNING: This uses 1.3/1.4 implementation details. |
static Component |
find(Component root,
AWT.ComponentPredicate test)
Find the first component matching the given predicate, or null if none found. |
static Component |
find(Component root,
Class type)
Find the first instance of the given class under the given component, or null if none found. |
static JPopupMenu |
findActivePopupMenu()
Find the currently active Swing popup menu, if any, waiting up to POPUP_TIMEOUT ms. |
static Applet |
findAppletDescendent(Container c)
Returns the Applet descendent of the given Container, if any. |
static MenuItem[] |
findAWTMenuItems(Frame frame,
String path)
Returns all MenuItems matching the given label or path which are found in the given Frame's MenuBar. |
static MenuItem[] |
findAWTPopupMenuItems(Component parent,
String path)
Returns all MenuItems matching the given label or path which are on PopupMenus on the given Component. |
static RootPaneContainer |
findRootPaneContainer(Container c)
Find the first instance of RootPaneContainer in the given
container. |
static JPopupMenu |
getActivePopupMenu()
Returns the currently active popup menu, if any. |
static Window |
getActiveWindow()
NOTE: NOT necessarily the same thing as the focused window. |
static sun.awt.AppContext |
getAppContext(Component c)
For debugging purposes only. |
static Window |
getFocusedWindow()
NOTE: on pointer-focused systems, the frontmost window is not necessarily the one with focus. |
static Component |
getFocusOwner()
Return the focus owner under the given Window. |
static Frame |
getFrame(Object o)
Return the Frame corresponding to the given object. |
static GraphicsConfiguration |
getGraphicsConfiguration(Point p)
Returns the GraphicsConfiguration which contains the given point, or null if none. |
static Insets |
getInsets(Container c)
|
static Component |
getInvoker(Component comp)
Returns the invoker, if any, of the given component. |
static Component |
getInvoker(MenuComponent mc)
Returns the invoker, if any, of the given AWT menu component. |
static String |
getKeyCode(int keycode)
|
static int |
getKeyCode(String code)
|
static String |
getKeyModifiers(int flags)
|
static Point |
getLocationOnScreen(Component c)
Safe version of Component.getLocationOnScreen() , which
avoids lockup if an AWT popup menu is showing. |
static String |
getModifiers(InputEvent event)
Convert the integer modifier flags into a string representation. |
static int |
getModifiers(String mods)
Convert the string representation into the actual modifier mask. |
static String |
getMouseModifiers(int flags)
|
static String |
getPath(MenuItem item)
Returns a unique path to the given MenuItem. |
static int |
getPopupMask()
Returns the InputEvent mask for the popup trigger button. |
static PopupMenu[] |
getPopupMenus(Component c)
Return all AWT popup menus associated with the given component. |
static boolean |
getPopupOnPress()
Returns whether the platform registers a popup on mouse press. |
static int |
getTertiaryMask()
Returns the InputEvent mask for the tertiary button. |
static Rectangle |
getVirtualDisplayBounds(boolean includeInsets)
Returns a Rectangle spanning all screens. |
static Rectangle |
getVisibleBounds(GraphicsConfiguration gc)
Return the visible bounds for the graphics configuration. |
static Window |
getWindow(Component comp)
Similar to SwingUtilities.getWindowAncestor(), but returns the component itself if it is a Window, or the invoker's window if on a popup. |
static Window |
getWindow(Object o)
Return the window corresponding to the given object. |
static boolean |
hasDefaultName(Component c)
Return whether the given Component has only its default name set. |
static boolean |
hierarchyHasHeavyweightComponent(Component base)
|
static void |
invokeAction(Runnable action)
Ensure the given action happens on the event dispatch thread. |
static void |
invokeAndWait(Runnable action)
Ensure the given action happens on the event dispatch thread. |
static boolean |
isAppletViewerFrame(Component c)
|
static boolean |
isAWTPopupMenuBlocking()
Returns whether there is an AWT popup menu currently showing. |
static boolean |
isAWTTreeLockHeld(EventQueue eq)
Returns whether the AWT Tree Lock is currently held. |
static boolean |
isContentPane(Component c)
Returns whether the given Component is the content pane for a RootPaneContainer . |
static boolean |
isGlassPane(Component c)
Returns whether the given Component is the Glass Pane for a JRootPane . |
static boolean |
isHeavyweightPopup(Component c)
Returns whether the given component is a heavyweight popup, that is, a container for a JPopupMenu that is implemented with a heavyweight component (usually a Window). |
static boolean |
isInternalFrameDecoration(Component c)
Return whether the given component is part of an internal frame's LAF decoration. |
static boolean |
isLightweightPopup(Component c)
Returns whether the given component is a lightweight popup, that is, a container for a JPopupMenu that is implemented with a lightweight component (usually JPanel). |
static boolean |
isMenuActive(Component c)
Returns true if there is an active menu on the JFrame (if any) containing the given component. |
static boolean |
isModifier(int keycode)
|
static boolean |
isOnMenuBar(MenuComponent mc)
Returns whether the menu component is on a MenuBar. |
static boolean |
isOnPopup(Component comp)
Returns whether the given component is on a top-level popup. |
static boolean |
isOnPopup(MenuComponent mc)
Returns whether the given MenuComponent is on a top-level AWT popup (that is, not under a MenuBar. |
static boolean |
isSharedInvisibleFrame(Component c)
Is the given component the default Swing hidden frame? |
static boolean |
isTertiaryButton(int mods)
Return whether this is the tertiary button, considering primary to be button1 and secondary to be the popup trigger button. |
static boolean |
isToolTip(Component c)
Return whether the given component is part of the transient wrapper around a tooltip. |
static boolean |
isTransientDialog(Component c)
Return whether the given component is part of a transient dialog. |
static boolean |
isTransientPopup(Component c)
Return whether the given component is part of the transient wrapper around a popup. |
static int |
keyCodeToMask(int code)
|
static int |
maskToKeyCode(int mask)
Convert the given modifier event mask to the equivalent key code. |
static void |
moveFrameRelativeTo(Frame frame,
Component relativeTo)
|
static boolean |
onScreen(Point p)
Return whether the given Point is visible on any screen. |
static boolean |
onScreen(Window w)
Returns whether one of the upper corners of the given window is accessible. |
static Component |
retargetMouseEvent(Component comp,
int id,
Point pt)
If a component does not have mouse events enabled, use the first ancestor which does. |
static void |
setHTMLPreferredWidth(JComponent c,
int width)
Ensure the given component renders its initial HTML wrapped at the given preferred width. |
static void |
setLocationByPlatform(Window w)
Set the position of the window in a platform-specific manner. |
static void |
showFrameRelative(Frame frame,
Component relativeTo)
Display a frame relative to the given component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int POPUP_TIMEOUT
public static final String CONTAINS_HEAVYWEIGHT_COMPONENT
Boolean.TRUE
as the value.
public static final Point DEFAULT_CASCADE
static final String ROOT_FRAME_CLASSNAME
Method Detail |
---|
public static boolean onScreen(Point p)
Point
is visible on any screen.
public static boolean onScreen(Window w)
public static GraphicsConfiguration getGraphicsConfiguration(Point p)
public static Rectangle getVirtualDisplayBounds(boolean includeInsets)
Includes any toolbar/dashboard regions.
public static Rectangle getVisibleBounds(GraphicsConfiguration gc)
public static void ensureOnScreen(Window w)
public static void setLocationByPlatform(Window w)
public static void setHTMLPreferredWidth(JComponent c, int width)
public static Color combine(Color c1, Color c2)
public static Color combine(Color c1, Color c2, float weight)
public static boolean isMenuActive(Component c)
public static void showFrameRelative(Frame frame, Component relativeTo)
public static void centerOnScreen(Window window)
Window
on the default screen.
public static void centerOnFrame(Window window, Frame frame)
public static void moveFrameRelativeTo(Frame frame, Component relativeTo)
public static boolean containsFocus(Component c)
public static Window getFocusedWindow()
public static Window getActiveWindow()
public static boolean hierarchyHasHeavyweightComponent(Component base)
public static Frame getFrame(Object o)
Frame
corresponding to the given object.
public static Window getWindow(Object o)
public static Color alpha(Color c, int alpha)
public static Component find(Component root, Class type)
public static void cascade(Window w)
Frame
.
public static void cascade(Window w, int xoff, int yoff)
Frame
.
public static Component find(Component root, AWT.ComponentPredicate test)
public static RootPaneContainer findRootPaneContainer(Container c)
RootPaneContainer
in the given
container. Basically finds applets.
public static boolean hasDefaultName(Component c)
public static void invokeAndWait(Runnable action)
public static void invokeAction(Runnable action)
public static boolean isOnMenuBar(MenuComponent mc)
public static Component getInvoker(MenuComponent mc)
public static Component getInvoker(Component comp)
public static Window getWindow(Component comp)
public static boolean isAWTPopupMenuBlocking()
public static boolean isAWTTreeLockHeld(EventQueue eq)
public static void dismissAWTPopup()
public static boolean isOnPopup(MenuComponent mc)
public static boolean isOnPopup(Component comp)
public static boolean isHeavyweightPopup(Component c)
public static boolean isLightweightPopup(Component c)
public static boolean isContentPane(Component c)
RootPaneContainer
.
RootPaneContainer.getContentPane()
public static boolean isGlassPane(Component c)
JRootPane
.
JRootPane.getGlassPane()
public static boolean isTransientPopup(Component c)
public static boolean isToolTip(Component c)
public static boolean isInternalFrameDecoration(Component c)
public static int getPopupMask()
public static int getTertiaryMask()
public static boolean getPopupOnPress()
public static PopupMenu[] getPopupMenus(Component c)
public static MenuItem[] findAWTPopupMenuItems(Component parent, String path)
public static MenuItem[] findAWTMenuItems(Frame frame, String path)
public static String getPath(MenuItem item)
public static Component getFocusOwner()
public static sun.awt.AppContext getAppContext(Component c)
public static boolean eventTypeEnabled(Component c, int id)
public static boolean isSharedInvisibleFrame(Component c)
public static boolean isAppletViewerFrame(Component c)
public static JPopupMenu getActivePopupMenu()
public static JPopupMenu findActivePopupMenu()
public static Point getLocationOnScreen(Component c)
Component.getLocationOnScreen()
, which
avoids lockup if an AWT popup menu is showing. The AWT popup
holds the AWT tree lock when showing, which lock is required by
Component.getLocationOnScreen()
.
public static boolean isTransientDialog(Component c)
Note that it is possible to use JOptionPane.createDialog to create a reusable dialog, so just because it's transient doesn't mean it will be disposed of when it is hidden.
Note that this won't detect transient Dialogs after their components have been reassigned to a new transient Dialog.
public static Applet findAppletDescendent(Container c)
public static boolean isTertiaryButton(int mods)
public static int getModifiers(String mods)
public static String getKeyModifiers(int flags)
public static String getMouseModifiers(int flags)
public static String getModifiers(InputEvent event)
public static String getKeyCode(int keycode)
public static int getKeyCode(String code)
public static boolean isModifier(int keycode)
public static int keyCodeToMask(int code)
public static int maskToKeyCode(int mask)
public static Component retargetMouseEvent(Component comp, int id, Point pt)
public static Insets getInsets(Container c)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |