Class Swing
- java.lang.Object
-
- com.inductiveautomation.snap.swing.Swing
-
public class Swing extends java.lang.ObjectThis class helps to load and manage panels of UI components in the form of a UI file, which is a simple XML description of UI controls.
-
-
Constructor Summary
Constructors Constructor Description Swing()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancallSwing(java.lang.Runnable aRunnable)Runs runnable later in Swing if thread not swing.static javax.swing.IconcreateIcon(java.lang.String aName, java.lang.Class aClass)Creates the named icon - tries to load from given owner class resource directory or current directory.static java.awt.ImagecreateImage(java.lang.String aName, java.lang.Class aClass)Creates the named image - tries to load from given owner class resource directory or current directory.static javax.swing.JComponentcreateUI(java.lang.Object aSource)This method loads a UI file from a byte source.static SwingHelpergetHelper(java.lang.Object anObj)Legacy.static JComponentHprgetHelper(javax.swing.JComponent aComponent)Legacy.static javax.swing.IcongetIcon(java.lang.String aName, java.lang.Class aClass)Returns the named icon - tries to load from given owner class resource directory or current directory.static java.awt.ImagegetImage(java.lang.String aName, java.lang.Class aClass)Returns the named image - tries to load from given owner class resource directory or current directory.static java.io.InputStreamgetInputStream(java.lang.String aName, java.lang.Class aClass)Returns an input stream for the given name - tries to load from given owner class resource dir or current dir.static voidinit()Initializes Snap Swing functionality (installs an event queue and configures helper map).static booleanisAltDown()Returns whether the alt key is down for the current input event.static booleanisMetaDown()Returns whether the meta key is down for the current input event.static booleanisMouseDown()Returns whether mouse is pressed in mouse drag loop.static booleanrunSwing(java.lang.Runnable aRunnable)Runs runnable later in Swing if thread not swing.static voidsendEvent(java.util.EventObject anEvent)Sends Event for the given EventObject.static voidsendEvent(java.util.EventObject anEvent, javax.swing.JComponent aComp)Sends Event for the given EventObject and component.
-
-
-
Method Detail
-
init
public static void init()
Initializes Snap Swing functionality (installs an event queue and configures helper map). This is called automatically when Ribs class is first touched.
-
createUI
public static javax.swing.JComponent createUI(java.lang.Object aSource)
This method loads a UI file from a byte source.
-
getImage
public static java.awt.Image getImage(java.lang.String aName, java.lang.Class aClass)Returns the named image - tries to load from given owner class resource directory or current directory.
-
createImage
@Nullable public static java.awt.Image createImage(java.lang.String aName, java.lang.Class aClass)Creates the named image - tries to load from given owner class resource directory or current directory.
-
getIcon
public static javax.swing.Icon getIcon(java.lang.String aName, java.lang.Class aClass)Returns the named icon - tries to load from given owner class resource directory or current directory.
-
createIcon
public static javax.swing.Icon createIcon(java.lang.String aName, java.lang.Class aClass)Creates the named icon - tries to load from given owner class resource directory or current directory.
-
getInputStream
public static java.io.InputStream getInputStream(java.lang.String aName, java.lang.Class aClass)Returns an input stream for the given name - tries to load from given owner class resource dir or current dir.
-
isAltDown
public static boolean isAltDown()
Returns whether the alt key is down for the current input event.
-
isMetaDown
public static boolean isMetaDown()
Returns whether the meta key is down for the current input event.
-
isMouseDown
public static boolean isMouseDown()
Returns whether mouse is pressed in mouse drag loop.
-
sendEvent
public static void sendEvent(java.util.EventObject anEvent)
Sends Event for the given EventObject.
-
sendEvent
public static void sendEvent(java.util.EventObject anEvent, javax.swing.JComponent aComp)Sends Event for the given EventObject and component.
-
getHelper
public static SwingHelper getHelper(java.lang.Object anObj)
Legacy.
-
getHelper
public static JComponentHpr getHelper(javax.swing.JComponent aComponent)
Legacy.
-
runSwing
public static boolean runSwing(java.lang.Runnable aRunnable)
Runs runnable later in Swing if thread not swing.
-
callSwing
public static boolean callSwing(java.lang.Runnable aRunnable)
Runs runnable later in Swing if thread not swing.
-
-