Class AwtExtensions


  • public final class AwtExtensions
    extends java.lang.Object
    The class AwtExtensions
    • Constructor Summary

      Constructors 
      Constructor Description
      AwtExtensions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.Component getRootJDialog​(java.awt.Component component)
      Gets the root JDialog from the given Component Object.
      static java.awt.Component getRootJFrame​(java.awt.Component component)
      Gets the root JFrame from the given Component Object.
      static java.awt.Component getRootParent​(java.awt.Component component)
      Gets the root parent from the given Component Object.
      static java.awt.Window getWindowForComponent​(java.awt.Component component)
      Gets the toplevel Frame or Dialog
      static java.awt.Cursor newInvisibleCursor()
      Creates an invisible cursor.
      static void setIconImage​(java.lang.String resourceName, java.awt.Window window)
      Sets the icon image from the given resource name and add it to the given window object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AwtExtensions

        public AwtExtensions()
    • Method Detail

      • getRootJDialog

        public static java.awt.Component getRootJDialog​(java.awt.Component component)
        Gets the root JDialog from the given Component Object.
        Parameters:
        component - The Component to find the root JDialog.
        Returns:
        's the root JDialog.
      • getRootJFrame

        public static java.awt.Component getRootJFrame​(java.awt.Component component)
        Gets the root JFrame from the given Component Object.
        Parameters:
        component - The Component to find the root JFrame.
        Returns:
        's the root JFrame.
      • getRootParent

        public static java.awt.Component getRootParent​(java.awt.Component component)
        Gets the root parent from the given Component Object.
        Parameters:
        component - The Component to find the root parent.
        Returns:
        's the root parent.
      • getWindowForComponent

        public static java.awt.Window getWindowForComponent​(java.awt.Component component)
                                                     throws java.awt.HeadlessException
        Gets the toplevel Frame or Dialog
        Parameters:
        component - the parent component
        Returns:
        the the toplevel Frame or Dialog
        Throws:
        java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
        See Also:
        GraphicsEnvironment.isHeadless()
      • newInvisibleCursor

        public static java.awt.Cursor newInvisibleCursor()
        Creates an invisible cursor.
        Returns:
        s the created invisible cursor.
      • setIconImage

        public static void setIconImage​(java.lang.String resourceName,
                                        java.awt.Window window)
                                 throws java.io.IOException
        Sets the icon image from the given resource name and add it to the given window object.
        Parameters:
        resourceName - The name from the resource. This includes the absolute path to the image icon from the classpath.
        window - the window in which to set the icon image.
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.