Package HAL.Gui

Class UIWindow

  • Direct Known Subclasses:
    InteractiveModel

    public class UIWindow
    extends java.lang.Object
    a JFrame wrapper that holds menu and gui items the window that the other gui items sit in
    • Field Summary

      Fields 
      Modifier and Type Field Description
      javax.swing.JFrame frame  
      javax.swing.JPanel panel  
    • Constructor Summary

      Constructors 
      Constructor Description
      UIWindow()
      the below constructors are variants of the above constructor with default values for some of the arguments
      UIWindow​(boolean active)  
      UIWindow​(boolean killOnClose, GuiCloseAction CloseAction)  
      UIWindow​(boolean killOnClose, GuiCloseAction CloseAction, boolean active)  
      UIWindow​(java.lang.String title)  
      UIWindow​(java.lang.String title, boolean active)  
      UIWindow​(java.lang.String title, boolean killOnClose, GuiCloseAction CloseAction)  
      UIWindow​(java.lang.String title, boolean killOnClose, GuiCloseAction CloseAction, boolean active)  
    • Method Summary

      Modifier and Type Method Description
      void AddCol​(int col, GuiComp comp)
      adds component by dropping down into the specified column think connect 4 or tetris
      void AddKeyResponses​(KeyResponse OnKeyDown, KeyResponse OnKeyUp)  
      void Close()
      destroys the gui with the window closing event
      boolean GetBool​(java.lang.String label)  
      double GetDouble​(java.lang.String label)  
      int GetInt​(java.lang.String label)  
      java.lang.String GetString​(java.lang.String label)  
      void GreyOut​(boolean onOff)
      Disables or enables all interacton with the UIWindow
      boolean IsActive()  
      boolean IsClosed()  
      boolean IsKeyDown​(char c)  
      boolean IsKeyDown​(int keyCode)  
      boolean IsRunning()  
      java.lang.String[] LabelStrings()  
      void RunGui()
      starts the gui thread and reveals the gui to the user
      void SetColor​(int backgroundColor)
      sets the gui background color
      void SetLables​(java.lang.String[] labels)  
      void SetParam​(java.lang.String label, java.lang.String value)  
      void SetParamChangeAction​(ParamSetChangeAction paramChangeAction)  
      void SetParamValues​(java.lang.String[] vals)  
      void SetValsAndLabels​(java.lang.String[] labels, java.lang.String[] vals)  
      void TickPause​(int millis)  
      java.lang.String[] ValueStrings()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • frame

        public final javax.swing.JFrame frame
      • panel

        public final javax.swing.JPanel panel
    • Constructor Detail

      • UIWindow

        public UIWindow​(java.lang.String title,
                        boolean killOnClose,
                        GuiCloseAction CloseAction,
                        boolean active)
        Parameters:
        title - the title that will appear at the top of the window
        killOnClose - whether the program should terminate on closing the window
        CloseAction - function that will run when the window is closed
        active - if set to false, the UIWindow will not actually render and its methods will be skipped (default true)
      • UIWindow

        public UIWindow()
        the below constructors are variants of the above constructor with default values for some of the arguments
      • UIWindow

        public UIWindow​(boolean active)
      • UIWindow

        public UIWindow​(boolean killOnClose,
                        GuiCloseAction CloseAction)
      • UIWindow

        public UIWindow​(boolean killOnClose,
                        GuiCloseAction CloseAction,
                        boolean active)
      • UIWindow

        public UIWindow​(java.lang.String title)
      • UIWindow

        public UIWindow​(java.lang.String title,
                        boolean active)
      • UIWindow

        public UIWindow​(java.lang.String title,
                        boolean killOnClose,
                        GuiCloseAction CloseAction)
    • Method Detail

      • TickPause

        public void TickPause​(int millis)
      • SetColor

        public void SetColor​(int backgroundColor)
        sets the gui background color
        Parameters:
        backgroundColor - default color of any empty space on the gui
      • SetParamChangeAction

        public void SetParamChangeAction​(ParamSetChangeAction paramChangeAction)
      • GreyOut

        public void GreyOut​(boolean onOff)
        Disables or enables all interacton with the UIWindow
        Parameters:
        onOff - whether to enable or disable the gui
      • IsKeyDown

        public boolean IsKeyDown​(char c)
      • IsKeyDown

        public boolean IsKeyDown​(int keyCode)
      • RunGui

        public void RunGui()
        starts the gui thread and reveals the gui to the user
      • IsActive

        public boolean IsActive()
      • IsRunning

        public boolean IsRunning()
      • IsClosed

        public boolean IsClosed()
      • SetParamValues

        public void SetParamValues​(java.lang.String[] vals)
      • GetInt

        public int GetInt​(java.lang.String label)
      • GetDouble

        public double GetDouble​(java.lang.String label)
      • GetString

        public java.lang.String GetString​(java.lang.String label)
      • GetBool

        public boolean GetBool​(java.lang.String label)
      • SetLables

        public void SetLables​(java.lang.String[] labels)
      • SetParam

        public void SetParam​(java.lang.String label,
                             java.lang.String value)
      • SetValsAndLabels

        public void SetValsAndLabels​(java.lang.String[] labels,
                                     java.lang.String[] vals)
      • ValueStrings

        public java.lang.String[] ValueStrings()
      • LabelStrings

        public java.lang.String[] LabelStrings()
      • AddCol

        public void AddCol​(int col,
                           GuiComp comp)
        adds component by dropping down into the specified column think connect 4 or tetris
        Parameters:
        col - column to drop from. the left end of the component will occupy this column
        comp - component to be added
      • Close

        public void Close()
        destroys the gui with the window closing event