Class UIToggleSet

All Implemented Interfaces:
UIContextActions, UIControlTarget, UIFocus, UIKeyFocus, UIMouseFocus, UITabFocus, LXLoopTask, LXParameterListener

public class UIToggleSet extends UIParameterComponent implements UIFocus, UIControlTarget, LXParameterListener
  • Constructor Details

    • UIToggleSet

      public UIToggleSet()
    • UIToggleSet

      public UIToggleSet(float x, float y, float w, float h)
    • UIToggleSet

      public UIToggleSet(float w, float h, DiscreteParameter parameter)
    • UIToggleSet

      public UIToggleSet(float x, float y, float w, float h, DiscreteParameter parameter)
  • Method Details

    • setActiveColor

      public UIToggleSet setActiveColor(int activeColor)
    • setActiveColor

      public UIToggleSet setActiveColor(UIColor activeColor)
    • getDescription

      public String getDescription()
      Description copied from class: UIObject
      Objects are encouraged to override this method providing a helpful String displayed to the user explaining the function of this UI component. If no help is available, return null rather than an empty String.
      Overrides:
      getDescription in class UIObject
      Returns:
      Helpful contextual string explaining function of this element
    • onResize

      protected void onResize()
      Description copied from class: UI2dComponent
      Subclasses may override this method, invoked when the component is resized
      Overrides:
      onResize in class UI2dComponent
    • setOptions

      public UIToggleSet setOptions(String[] options)
    • getParameter

      public DiscreteParameter getParameter()
      Specified by:
      getParameter in class UIParameterComponent
    • setParameter

      public UIToggleSet setParameter(DiscreteParameter parameter)
    • onParameterChanged

      public void onParameterChanged(LXParameter parameter)
      Description copied from interface: LXParameterListener
      Invoked when the value of a parameter is changed.
      Specified by:
      onParameterChanged in interface LXParameterListener
      Parameters:
      parameter - The parameter that has changed its value
    • setEvenSpacing

      public UIToggleSet setEvenSpacing()
    • setEvenSpacing

      public UIToggleSet setEvenSpacing(boolean evenSpacing)
    • getSelectedIndex

      public int getSelectedIndex()
      Gets the index of the currently selected value in the toggle set
      Returns:
      currently selected index
    • getSelectedOption

      public String getSelectedOption()
      Get the currently selected option in the toggle set
      Returns:
      Currently selected value
    • setSelectedOption

      public UIToggleSet setSelectedOption(String option)
      Sets the value of the control to the given value in the toggle set
      Parameters:
      option - String value, must be one of the options in the toggle set
      Returns:
      this
    • setSelectedIndex

      public UIToggleSet setSelectedIndex(int index)
      Sets the selected index in the toggle set
      Parameters:
      index - Index in the toggle set, from 0 to range-1
      Returns:
      this
    • onDraw

      public void onDraw(UI ui, VGraphics vg)
      Description copied from class: UI2dComponent
      Subclasses should override this method to perform their drawing functions.
      Overrides:
      onDraw in class UI2dComponent
      Parameters:
      ui - UI context
      vg - Graphics context
    • onToggle

      protected void onToggle(int value)
    • onToggle

      protected void onToggle(String option)
    • onMousePressed

      protected void onMousePressed(MouseEvent mouseEvent, float mx, float my)
      Description copied from class: UIEventHandler
      Subclasses override to receive mouse events
      Overrides:
      onMousePressed in class UIParameterComponent
      Parameters:
      mouseEvent - Mouse event
      mx - x-coordinate
      my - y-coordinate
    • onKeyPressed

      protected void onKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode)
      Description copied from class: UIEventHandler
      Subclasses override to receive key events
      Overrides:
      onKeyPressed in class UIEventHandler
      Parameters:
      keyEvent - Key event
      keyChar - Key character
      keyCode - Key code value
    • getControlTarget

      public LXNormalizedParameter getControlTarget()
      Specified by:
      getControlTarget in interface UIControlTarget
    • dispose

      public void dispose()
      Overrides:
      dispose in class UIObject