Package snap.swing

Class SwingUtils

java.lang.Object
snap.swing.SwingUtils

public class SwingUtils extends Object
This class offers a number of useful general purpose Swing utilities.
  • Constructor Details

    • SwingUtils

      public SwingUtils()
  • Method Details

    • getWindow

      public static Window getWindow(Component aComponent)
      Returns the first parent of given component which is window.
    • getParent

      public static <T> T getParent(Component aComponent, Class<T> aClass)
      Returns the first parent of given component which is an instance of given class.
    • getString

      public static String getString(Transferable aTrans)
      Returns a string from given transferable.
    • getFiles

      public static List<File> getFiles(Transferable aTrans)
      Returns a list of files from a given transferable.
    • getKeyText

      public static String getKeyText(KeyStroke aKeyStroke)
      This utility method returns key text for a key stroke and tries to make it more conforming.
    • getKeyStroke

      public static KeyStroke getKeyStroke(String aKey)
      This utility method tries to get a keystroke from a string and tries to be more forgiving than KeyStroke.getKeyStroke().
    • getScreenSizeAvailable

      public static Dimension getScreenSizeAvailable(Component aComp, int anX, int aY)
      Returns the size available from given point to in component to bottom right of component screen.
    • getScreenBounds

      public static Rectangle getScreenBounds(Component aComp, int anX, int aY, boolean doInset)
      Returns the screen bounds for a component location (or screen location if component null).
    • getGraphicsConfiguration

      public static GraphicsConfiguration getGraphicsConfiguration(Component aComp, int anX, int aY)
      Returns the GraphicsConfiguration for a point.