Package org.jdesktop.application.utils
Class SwingHelper
- java.lang.Object
-
- org.jdesktop.application.utils.SwingHelper
-
public final class SwingHelper extends java.lang.Object
Utility class for Swing Application Framework (BSAF)- Since:
- 1.9
- Author:
- Illya Yalovyy, Eric Heumann
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.Rectangle
computeVirtualGraphicsBounds()
Calculates virtual graphic bounds.static java.awt.Point
defaultLocation(java.awt.Window window)
Calculates default location for the specified window.static javax.swing.RootPaneContainer
findRootPaneContainer(java.awt.Component root)
Finds the nearest RootPaneContainer of the provided Component.static java.awt.Rectangle
getWindowNormalBounds(java.awt.Window window)
GetsWindow
bounds from the client propertystatic boolean
isResizable(java.awt.Window window)
Checks whether the window supports resizingstatic void
putWindowNormalBounds(java.awt.Window window, java.awt.Rectangle bounds)
PutsWindow
bounds to client property.
-
-
-
Method Detail
-
computeVirtualGraphicsBounds
public static java.awt.Rectangle computeVirtualGraphicsBounds()
Calculates virtual graphic bounds. On multiscreen systems all screens are united into one virtual screen.- Returns:
- the graphic bounds
-
isResizable
public static boolean isResizable(java.awt.Window window)
Checks whether the window supports resizing- Parameters:
window
- theWindow
to be checked- Returns:
- true if the window supports resizing
-
defaultLocation
public static java.awt.Point defaultLocation(java.awt.Window window)
Calculates default location for the specified window.- Parameters:
window
- the window location is calculated for. It should not be null.- Returns:
- default location for the window
-
findRootPaneContainer
public static javax.swing.RootPaneContainer findRootPaneContainer(java.awt.Component root)
Finds the nearest RootPaneContainer of the provided Component. Primarily, if a JPopupMenu (such as used by JMenus when they are visible) has no parent, the search continues with the JPopupMenu's invoker instead. Fixes BSAF-77- Parameters:
root
- the Component- Returns:
- a RootPaneContainer for the provided component
-
getWindowNormalBounds
public static java.awt.Rectangle getWindowNormalBounds(java.awt.Window window)
GetsWindow
bounds from the client property- Parameters:
window
- the sourceWindow
- Returns:
- bounds from the client property
-
putWindowNormalBounds
public static void putWindowNormalBounds(java.awt.Window window, java.awt.Rectangle bounds)
PutsWindow
bounds to client property.- Parameters:
window
- the targetWindow
bounds
- bounds
-
-