Class Swing


  • public class Swing
    extends java.lang.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
      Swing()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean callSwing​(java.lang.Runnable aRunnable)
      Runs runnable later in Swing if thread not swing.
      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.
      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.
      static javax.swing.JComponent createUI​(java.lang.Object aSource)
      This method loads a UI file from a byte source.
      static SwingHelper getHelper​(java.lang.Object anObj)
      Legacy.
      static JComponentHpr getHelper​(javax.swing.JComponent aComponent)
      Legacy.
      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.
      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.
      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.
      static void init()
      Initializes Snap Swing functionality (installs an event queue and configures helper map).
      static boolean isAltDown()
      Returns whether the alt key is down for the current input event.
      static boolean isMetaDown()
      Returns whether the meta key is down for the current input event.
      static boolean isMouseDown()
      Returns whether mouse is pressed in mouse drag loop.
      static boolean runSwing​(java.lang.Runnable aRunnable)
      Runs runnable later in Swing if thread not swing.
      static void sendEvent​(java.util.EventObject anEvent)
      Sends Event for the given EventObject.
      static void sendEvent​(java.util.EventObject anEvent, javax.swing.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 Detail

      • Swing

        public Swing()
    • 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.