Class SwingUtils

java.lang.Object
com.inductiveautomation.snap.swing.SwingUtils

public class SwingUtils extends Object
This class offers a number of useful general purpose utilities used by ribs classes.
  • 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.
    • invokeLater

      public static void invokeLater(Object anObj, String aMethod)
      Invokes an given method on a given object after delay.
    • invokeLater

      public static void invokeLater(Object anObj, String aMethod, Object anArg, Class anArgClass)
      Invokes an given method on a given object after delay, with given arg and arg class.
    • invokeLater

      public static void invokeLater(Runnable aRunnable, int aCount)
      InvokesLater for a given count before running given runnable, in order to skip past events yet to be posted.
    • invokeLaterOnce

      public static void invokeLaterOnce(String aName, Runnable aRunnable)
      Invokes the given runnable for name once (cancels unexecuted previous invokeLater registered with same name).
    • getIcon

      public static Icon getIcon(Shape aShape, Color aColor, int aWidth, int aHeight)
      Returns an icon for the given shape, color and size.
    • getImageIcon

      public static ImageIcon getImageIcon(Shape aShape, Color aColor, int aWidth, int aHeight)
      Returns an image icon for the given shape, color and size.
    • getDefaultFocusComponent

      public static JComponent getDefaultFocusComponent(Component aComponent)
      Returns the default focus component.