Class SpinnerNumberOption

All Implemented Interfaces:
Serializable, Option, OptionElement, OptionProperties

public class SpinnerNumberOption extends AbstractOption
An option that uses a JSpinner control to edit its value.
Author:
Laurent Cohen
See Also:
  • Field Details

    • spinnerLabel

      protected JLabel spinnerLabel
      Label associated with the JSpinner field.
    • min

      protected Number min
      Minimum value for the spinner control.
    • max

      protected Number max
      Maximum value for the spinner control.
    • step

      protected Number step
      Step size for the spinner control.
    • nf

      protected NumberFormat nf
      Use to parse from string values to Number instances.
    • pattern

      protected String pattern
      The number format pattern.
  • Constructor Details

    • SpinnerNumberOption

      public SpinnerNumberOption()
      Constructor provided as a convenience to facilitate the creation of option elements through reflexion.
  • Method Details

    • createUI

      public void createUI()
      Description copied from class: AbstractOptionProperties
      Create the UI components for this option.
      Specified by:
      createUI in class AbstractOptionProperties
    • getValue

      public Object getValue()
      Get the current value for this option.
      Specified by:
      getValue in interface Option
      Overrides:
      getValue in class AbstractOption
      Returns:
      a Number instance.
    • setValue

      public void setValue(Object value)
      Set the current value for this option.
      Overrides:
      setValue in class AbstractOption
      Parameters:
      value - a Number instance.
    • setupValueChangeNotifications

      protected void setupValueChangeNotifications()
      Propagate the selection changes in the underlying combo box to the listeners to this option.
      Specified by:
      setupValueChangeNotifications in class AbstractOption
      See Also:
    • setEnabled

      public void setEnabled(boolean enabled)
      Enable or disable this option.
      Parameters:
      enabled - true to enable this option, false to disable it.
    • getMax

      public Number getMax()
      Get the maximum value for the spinner control.
      Returns:
      the value as a Number.
    • setMax

      public void setMax(Number max)
      Set the maximum value for the spinner control.
      Parameters:
      max - the value as a Number.
    • getMin

      public Number getMin()
      Get the minimum value for the spinner control.
      Returns:
      the value as a Number.
    • setMin

      public void setMin(Number min)
      Set the minimum value for the spinner control.
      Parameters:
      min - the value a Number.
    • getStep

      public Number getStep()
      Get ttep size for the spinner control.
      Returns:
      the step size as a Number.
    • setStep

      public void setStep(Number step)
      Set ttep size for the spinner control.
      Parameters:
      step - the step size as a Number.
    • toString

      public String toString()
      Description copied from class: AbstractOptionElement
      Get a string representation of this element.
      Overrides:
      toString in class AbstractOption
      Returns:
      a string providing information about this option element.
      See Also:
    • getPattern

      public String getPattern()
      Get the number format pattern.
      Returns:
      the pattern as a string.
    • setPattern

      public void setPattern(String pattern)
      Set the number format pattern.
      Parameters:
      pattern - the pattern as a string.
    • getSpinnerLabel

      public JLabel getSpinnerLabel()
      Get tabel associated with the JSpinner field.
      Returns:
      a JLabel instance.