Class Swing

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

public class Swing extends Object
This 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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    callSwing(Runnable aRunnable)
    Runs runnable later in Swing if thread not swing.
    static Icon
    createIcon(String aName, Class aClass)
    Creates the named icon - tries to load from given owner class resource directory or current directory.
    static Image
    createImage(String aName, Class aClass)
    Creates the named image - tries to load from given owner class resource directory or current directory.
    static JComponent
    createUI(Object aSource)
    This method loads a UI file from a byte source.
    Legacy.
    getHelper(JComponent aComponent)
    Legacy.
    static Icon
    getIcon(String aName, Class aClass)
    Returns the named icon - tries to load from given owner class resource directory or current directory.
    static Image
    getImage(String aName, Class aClass)
    Returns the named image - tries to load from given owner class resource directory or current directory.
    getInputStream(String aName, Class aClass)
    Returns an input stream for the given name - tries to load from given owner class resource dir or current dir.
    static void
    Initializes Snap Swing functionality (installs an event queue and configures helper map).
    static boolean
    Returns whether the alt key is down for the current input event.
    static boolean
    Returns whether the meta key is down for the current input event.
    static boolean
    Returns whether mouse is pressed in mouse drag loop.
    static boolean
    runSwing(Runnable aRunnable)
    Runs runnable later in Swing if thread not swing.
    static void
    Sends Event for the given EventObject.
    static void
    sendEvent(EventObject anEvent, JComponent aComp)
    Sends Event for the given EventObject and component.

    Methods inherited from class java.lang.Object

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

    • Swing

      public Swing()
  • Method Details

    • 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 JComponent createUI(Object aSource)
      This method loads a UI file from a byte source.
    • getImage

      public static Image getImage(String aName, Class aClass)
      Returns the named image - tries to load from given owner class resource directory or current directory.
    • createImage

      @Nullable public static Image createImage(String aName, Class aClass)
      Creates the named image - tries to load from given owner class resource directory or current directory.
    • getIcon

      public static Icon getIcon(String aName, Class aClass)
      Returns the named icon - tries to load from given owner class resource directory or current directory.
    • createIcon

      public static Icon createIcon(String aName, Class aClass)
      Creates the named icon - tries to load from given owner class resource directory or current directory.
    • getInputStream

      public static InputStream getInputStream(String aName, 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(EventObject anEvent)
      Sends Event for the given EventObject.
    • sendEvent

      public static void sendEvent(EventObject anEvent, JComponent aComp)
      Sends Event for the given EventObject and component.
    • getHelper

      public static SwingHelper getHelper(Object anObj)
      Legacy.
    • getHelper

      public static JComponentHpr getHelper(JComponent aComponent)
      Legacy.
    • runSwing

      public static boolean runSwing(Runnable aRunnable)
      Runs runnable later in Swing if thread not swing.
    • callSwing

      public static boolean callSwing(Runnable aRunnable)
      Runs runnable later in Swing if thread not swing.