Package swingtree

Class UIForSpinner<S extends JSpinner>


public final class UIForSpinner<S extends JSpinner> extends UIForAnySwing<UIForSpinner<S>,S>
A SwingTree builder node designed for configuring JSpinner instances.
  • Method Details

    • _state

      protected swingtree.BuilderState<S> _state()
      Description copied from class: UIForAnything
      Returns the state of the builder, which is a container for the wrapped component as well as it's type and current EventProcessor.
      Specified by:
      _state in class UIForAnything<UIForSpinner<S extends JSpinner>,S extends JSpinner,JComponent>
      Returns:
      The state of the builder.
    • _newBuilderWithState

      protected UIForSpinner<S> _newBuilderWithState(swingtree.BuilderState<S> newState)
      Description copied from class: UIForAnything
      An internal wither method which creates a new builder instance with the provided BuilderState stored inside it.
      Specified by:
      _newBuilderWithState in class UIForAnything<UIForSpinner<S extends JSpinner>,S extends JSpinner,JComponent>
      Parameters:
      newState - The new state which should be stored inside the new builder instance.
      Returns:
      A new builder instance with the provided state stored inside it.
    • onChange

      public final UIForSpinner<S> onChange(sprouts.Action<ComponentDelegate<JSpinner,ChangeEvent>> action)
      Adds an Action to the underlying JSpinner through an ChangeListener, Use this to register an action to be performed when the spinner's value changes.
      Parameters:
      action - The action to be performed.
      Returns:
      This very instance, which enables builder-style method chaining.
    • withValue

      public final UIForSpinner<S> withValue(Object value)
      Sets the value of the spinner.
      Parameters:
      value - The value to set.
      Returns:
      This very instance, which enables builder-style method chaining.
      Throws:
      IllegalArgumentException - if value is null.
    • withValue

      public final UIForSpinner<S> withValue(sprouts.Val<?> value)
      Sets the value of the spinner and also binds to said value.
      Parameters:
      value - The Val wrapper whose value should be set.
      Returns:
      This very instance, which enables builder-style method chaining.
      Throws:
      IllegalArgumentException - if value is null.
    • withValue

      public final UIForSpinner<S> withValue(sprouts.Var<?> value)
      Sets the value of the spinner and also binds to the provided property.
      Parameters:
      value - The Var wrapper whose value should be set.
      Returns:
      This very instance, which enables builder-style method chaining.
      Throws:
      IllegalArgumentException - if value is null.
    • withStepSize

      public final UIForSpinner<S> withStepSize(Number n)
      Sets the numeric step size of the value of the spinner. This expects your spinner to be based on the SpinnerNumberModel.
      Parameters:
      n - The Number which should be set as step size.
      Returns:
      This very instance, which enables builder-style method chaining.
    • withStepSize

      public final <N extends Number> UIForSpinner<S> withStepSize(sprouts.Val<N> val)
      Sets the numeric step size of the value of the spinner and also binds to said value. This expects your spinner to be based on the SpinnerNumberModel.
      Type Parameters:
      N - The type of the number.
      Parameters:
      val - The Val wrapper whose step size should be set.
      Returns:
      This very instance, which enables builder-style method chaining.
      Throws:
      IllegalArgumentException - if val is null.