Class 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)
      Gets Window bounds from the client property
      static boolean isResizable​(java.awt.Window window)
      Checks whether the window supports resizing
      static void putWindowNormalBounds​(java.awt.Window window, java.awt.Rectangle bounds)
      Puts Window bounds to client property.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 - the Window 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)
        Gets Window bounds from the client property
        Parameters:
        window - the source Window
        Returns:
        bounds from the client property
      • putWindowNormalBounds

        public static void putWindowNormalBounds​(java.awt.Window window,
                                                 java.awt.Rectangle bounds)
        Puts Window bounds to client property.
        Parameters:
        window - the target Window
        bounds - bounds