Package info.monitorenter.util
Class UIUtil
- java.lang.Object
-
- info.monitorenter.util.UIUtil
-
public final class UIUtil extends java.lang.ObjectUtility class for UI / layout operations.- Version:
- $Revision: 1.11 $
- Author:
- Achim Westermann
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.awt.WindowfindDialogWindow(java.awt.Component component)Finds the window of the given component.static java.awt.FramefindFrame(java.awt.Component component)Finds the frame of the given component.static javax.swing.JPopupMenufindPopupMenu(java.awt.Component component)Finds the parentJPopupMenuof the given component, it it is contained in the component tree of one.static javax.swing.JPopupMenufindTopLevelPopupMenu(java.awt.Component component)Finds the top level parentJPopupMenuof the given component, it it is contained in the component tree of one.static java.awt.PointgetLocationOnScreen(java.awt.event.MouseEvent e)Deprecated.Replace with Point.getLocationOnScreen(MouseEvent) as soon as jdk 1.6 is used.
-
-
-
Method Detail
-
findDialogWindow
public static java.awt.Window findDialogWindow(java.awt.Component component)
Finds the window of the given component.This will be the top-level frame for components that are contained directly in that window. For components that are contained in
windows the dialog window will be returned. For components that are contained inDialogtrees the window that triggers that menu will be returned.JMenu- Parameters:
component- the component to find the master the JFrame of.- Returns:
- the frame of the given component.
-
findFrame
public static java.awt.Frame findFrame(java.awt.Component component)
Finds the frame of the given component.The component may be contained in a
(with support for modal dialogs) and still it's frame (the top level window of the application) will be found. Support for components launched fromJDialoginstances is included.JPopupMenuThis also works for nested
/JMenutrees.JMenuItem- Parameters:
component- the component to find the master the JFrame of.- Returns:
- the frame of the given component.
-
findPopupMenu
public static javax.swing.JPopupMenu findPopupMenu(java.awt.Component component)
Finds the parentJPopupMenuof the given component, it it is contained in the component tree of one.- Parameters:
component- a potential sub component of a popup menu.- Returns:
- the popup menu of the given component or null.
-
findTopLevelPopupMenu
public static javax.swing.JPopupMenu findTopLevelPopupMenu(java.awt.Component component)
Finds the top level parentJPopupMenuof the given component, it it is contained in the component tree of one.JPopupMenutrees may contain many sub menu instances.- Parameters:
component- a potential sub component of a popup menu.- Returns:
- the popup menu of the given component or null.
-
getLocationOnScreen
@Deprecated public static java.awt.Point getLocationOnScreen(java.awt.event.MouseEvent e)
Deprecated.Replace with Point.getLocationOnScreen(MouseEvent) as soon as jdk 1.6 is used.This is a workaround for the missing callin pre jdk 1dot6.Point#getLocationOnScreen(MouseEvent e)- Parameters:
e- needed to get the location on screen of.- Returns:
- the absolute location of the mouse event in the window (vs. component).
-
-