Class TitledSlider

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class TitledSlider extends JPanel implements ChangeListener
JSlider with a titled border
See Also:
  • Field Details

  • Constructor Details

    • TitledSlider

      public TitledSlider(String title, int index, UpdateNV update)
      Construct a new titledSlider
      Parameters:
      title - to be displayed
      index - of the associated NV
      update - callback funtion to apply new value
  • Method Details

    • init

      public void init(int min, int max, int init)
      Initialise the slider
      Parameters:
      init - Initial value
      min - Minimum value
      max - Maximum value
    • setValue

      public void setValue(int v)
      Set slider value Only do this if value has actually changed, otherwise we can trigger an endless round of updating to the table and the gui.
      Parameters:
      v - value
    • getValue

      public int getValue()
      Get slider value
      Returns:
      slider value
    • setToolTip

      public void setToolTip(String tt)
      Set the tool tip
      Parameters:
      tt - tooltip text
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Call back with updated value We restrict the frequency of updates, with a timer, whilst the slider is adjusting to, prevent CBUS replies from earlier updates looking like a new value change and triggering another update as this can lead to an endless round of updates.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - the slider change event
    • getPreferredSize

      The preferred width on the panel must consider the width of the text used on the TitledBorder from
      Overrides:
      getPreferredSize in class JComponent