Class SwingUtils
- java.lang.Object
-
- com.inductiveautomation.snap.swing.SwingUtils
-
public class SwingUtils extends java.lang.Object
This class offers a number of useful general purpose utilities used by ribs classes.
-
-
Constructor Summary
Constructors Constructor Description SwingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.swing.JComponent
getDefaultFocusComponent(java.awt.Component aComponent)
Returns the default focus component.static javax.swing.Icon
getIcon(java.awt.Shape aShape, java.awt.Color aColor, int aWidth, int aHeight)
Returns an icon for the given shape, color and size.static javax.swing.ImageIcon
getImageIcon(java.awt.Shape aShape, java.awt.Color aColor, int aWidth, int aHeight)
Returns an image icon for the given shape, color and size.static <T> T
getParent(java.awt.Component aComponent, java.lang.Class<T> aClass)
Returns the first parent of given component which is an instance of given class.static java.awt.Window
getWindow(java.awt.Component aComponent)
Returns the first parent of given component which is window.static void
invokeLater(java.lang.Object anObj, java.lang.String aMethod)
Invokes an given method on a given object after delay.static void
invokeLater(java.lang.Object anObj, java.lang.String aMethod, java.lang.Object anArg, java.lang.Class anArgClass)
Invokes an given method on a given object after delay, with given arg and arg class.static void
invokeLater(java.lang.Runnable aRunnable, int aCount)
InvokesLater for a given count before running given runnable, in order to skip past events yet to be posted.static void
invokeLaterOnce(java.lang.String aName, java.lang.Runnable aRunnable)
Invokes the given runnable for name once (cancels unexecuted previous invokeLater registered with same name).
-
-
-
Method Detail
-
getWindow
public static java.awt.Window getWindow(java.awt.Component aComponent)
Returns the first parent of given component which is window.
-
getParent
public static <T> T getParent(java.awt.Component aComponent, java.lang.Class<T> aClass)
Returns the first parent of given component which is an instance of given class.
-
invokeLater
public static void invokeLater(java.lang.Object anObj, java.lang.String aMethod)
Invokes an given method on a given object after delay.
-
invokeLater
public static void invokeLater(java.lang.Object anObj, java.lang.String aMethod, java.lang.Object anArg, java.lang.Class anArgClass)
Invokes an given method on a given object after delay, with given arg and arg class.
-
invokeLater
public static void invokeLater(java.lang.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(java.lang.String aName, java.lang.Runnable aRunnable)
Invokes the given runnable for name once (cancels unexecuted previous invokeLater registered with same name).
-
getIcon
public static javax.swing.Icon getIcon(java.awt.Shape aShape, java.awt.Color aColor, int aWidth, int aHeight)
Returns an icon for the given shape, color and size.
-
getImageIcon
public static javax.swing.ImageIcon getImageIcon(java.awt.Shape aShape, java.awt.Color aColor, int aWidth, int aHeight)
Returns an image icon for the given shape, color and size.
-
getDefaultFocusComponent
public static javax.swing.JComponent getDefaultFocusComponent(java.awt.Component aComponent)
Returns the default focus component.
-
-