Class Spinner3D

All Implemented Interfaces:
Animation, Editable, StyleListener, InternalPickerWidget, Iterable<Component>

public class Spinner3D extends Container implements InternalPickerWidget

A scrolling wheel of values styled after the iOS picker, and the body of a lightweight Picker.

Rows come from a ListModel, so the contents can be anything a model can produce; the selection is whatever that model holds at the selected index. Spinner3D is the plain-list member of the family, beside DateSpinner3D, TimeSpinner3D, DateTimeSpinner3D and DurationSpinner3D.

It is an ordinary Container, so it can be added to a form directly rather than shown through a picker dialog -- which is why it is public. Use Picker instead when you want the platform's native picker where one exists, because a Picker falls back to this only in lightweight mode.

getValue() and setValue(Object) carry the selected model element.

  • Constructor Details

    • Spinner3D

      public Spinner3D(ListModel<String> listModel)

      Creates a new Spinner3D with the given listModel.

      Parameters
      • listModel
  • Method Details

    • create

      public static Spinner3D create(double min, double max, double currentValue, double step)

      Creates a new numeric spinner instance

      Parameters
      • min: lowest value allowed

      • max: maximum value allowed

      • currentValue: the starting value for the mode

      • step: the value by which we increment the entries in the model

      Returns

      new spinner instance

    • create

      public static Spinner3D create(int min, int max, int currentValue, int step)
    • createDate

      public static Spinner3D createDate(long min, long max, long currentValue)

      Creates a new date spinner instance

      Parameters
      • min: lowest value allowed

      • max: maximum value allowed

      • currentValue: the starting value for the mode

      Returns

      new spinner instance

    • getSelectedIndex

      public int getSelectedIndex()
    • setModel

      public void setModel(ListModel model)
    • getValue

      public Object getValue()
      Description copied from interface: InternalPickerWidget

      The currently selected value.

      Returns

      the selection, in whatever type this implementation documents; never null once the widget has been laid out

      Specified by:
      getValue in interface InternalPickerWidget
    • setValue

      public void setValue(Object value)
      Description copied from interface: InternalPickerWidget

      Moves the selection to value.

      The widget scrolls to the new selection rather than jumping, when it is already on screen.

      Parameters
      • value: the new selection, in the type this implementation documents. A value outside the widget's range is clamped into it.
      Specified by:
      setValue in interface InternalPickerWidget
    • getRowStyle

      public Style getRowStyle()
    • getSelectedRowStyle

      public Style getSelectedRowStyle()
    • getSelectedOverlayStyle

      public Style getSelectedOverlayStyle()
    • paint

      public void paint(Graphics g)
      Description copied from class: Container

      This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

      Parameters
      • g: the component graphics
      Specified by:
      paint in interface Animation
      Overrides:
      paint in class Container