Class WSpinBox

public class WSpinBox extends WAbstractSpinBox
An input control for integer numbers.

The spin box provides a control for entering an integer number. It consists of a line edit, and buttons which allow to increase or decrease the value. If you rather need input of a fractional number, use WDoubleSpinBox instead.

WSpinBox is an inline widget.

See Also:
  • Constructor Details

    • WSpinBox

      public WSpinBox(WContainerWidget parentContainer)
      Creates a spin-box.

      The range is (0 - 99) and the step size 1.

      The initial value is 0.

    • WSpinBox

      public WSpinBox()
      Creates a spin-box.

      Calls this((WContainerWidget)null)

  • Method Details

    • setMinimum

      public void setMinimum(int minimum)
      Sets the minimum value.

      The default value is 0.

    • getMinimum

      public int getMinimum()
      Returns the minimum value.

      See Also:
    • setMaximum

      public void setMaximum(int maximum)
      Sets the maximum value.

      The default value is 99.

    • getMaximum

      public int getMaximum()
      Returns the maximum value.

      See Also:
    • setRange

      public void setRange(int minimum, int maximum)
      Sets the range.

      See Also:
    • setSingleStep

      public void setSingleStep(int step)
      Sets the step value.

      The default value is 1.

    • getSingleStep

      public int getSingleStep()
      Returns the step value.
    • setValue

      public void setValue(int value)
      Sets the value.

      value must be a value between getMinimum() and getMaximum().

      The default value is 0

    • getValue

      public int getValue()
      Returns the value.

      Note: This value may not correctly reflect the WLineEdit.getValueText() of the spin box if WLineEdit.getValueText() is empty or if the contents are not in a valid state.

    • setWrapAroundEnabled

      public void setWrapAroundEnabled(boolean enabled)
      Sets if this spinbox wraps around to stay in the valid range.

      Note: Not supported by the native controls.

    • isWrapAroundEnabled

      public boolean isWrapAroundEnabled()
      Returns if the spinbox wraps around.

      See Also:
    • valueChanged

      public Signal1<Integer> valueChanged()
      A signal that indicates when the value has changed.

      This signal is emitted when WFormWidget.changed() is emitted, but supplies the new value as an argument. The WFormWidget.changed() signal is emitted when the user changes the value of the spinbox by pressing the up/down arrow, or entering a different value and pressing enter or moving focus.

      See Also:
    • getTextFromValue

      protected String getTextFromValue()
      Specified by:
      getTextFromValue in class WAbstractSpinBox
    • getValidateRange

      protected WValidator.Result getValidateRange()
      Specified by:
      getValidateRange in class WAbstractSpinBox