# Class Picker

java.lang.Object
com.codename1.ui.Component
com.codename1.ui.Label
com.codename1.ui.Button
com.codename1.ui.spinner.Picker

All Implemented Interfaces:
  `Animation, Editable, ActionSource<ActionEvent>, StyleListener, IconHolder, ReleasableComponent, SelectableIconHolder, TextHolder`

public class Picker extends Button

`Picker` is a component and API that allows either popping up a spinner or using the native picker API when applicable. This is quite important for some platforms where the native spinner behavior is very hard to replicate.

    Form hi = new Form("Picker", new BoxLayout(BoxLayout.Y_AXIS));
    Picker datePicker = new Picker();
    datePicker.setType(Display.PICKER_TYPE_DATE);
    Picker dateTimePicker = new Picker();
    dateTimePicker.setType(Display.PICKER_TYPE_DATE_AND_TIME);
    Picker timePicker = new Picker();
    timePicker.setType(Display.PICKER_TYPE_TIME);
    Picker stringPicker = new Picker();
    stringPicker.setType(Display.PICKER_TYPE_STRINGS);

    datePicker.setDate(new Date());
    dateTimePicker.setDate(new Date());
    timePicker.setTime(10 * 60); // 10:00AM = Minutes since midnight
    stringPicker.setStrings("A Game of Thrones", "A Clash Of Kings", "A Storm Of Swords", "A Feast For Crows",
            "A Dance With Dragons", "The Winds of Winter", "A Dream of Spring");
    stringPicker.setSelectedString("A Game of Thrones");

    hi.add(datePicker).add(dateTimePicker).add(timePicker).add(stringPicker);
    hi.show();

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `Picker.DateGetter`
  Functional interface that supplies the default `Date` to display when a date-type picker is opened without an explicit value.
  `static final class`
  `Picker.LightweightPopupButtonPlacement`
  Placement options for custom lightweight popup buttons.

- ## Field Summary

  ### Fields inherited from class Button

  `STATE_DEFAULT, STATE_PRESSED, STATE_ROLLOVER`

  ### Fields inherited from class Component

  `BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Picker()`
  Default constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addLightweightPopupButton(String text, Runnable action)`
  Adds a custom button to the lightweight picker popup in the default placement between the `Cancel` and `Done` areas.
  `void`
  `addLightweightPopupButton(String text, Runnable action, int placement)`
  Adds a custom button to the lightweight picker popup with the default `Component#LEFT` alignment.
  `void`
  `addLightweightPopupButton(String text, Runnable action, int placement, int alignment)`
  Adds a custom button to the lightweight picker popup at a specific horizontal alignment within its row.
  `void`
  `clearLightweightPopupButtons()`
  Removes all custom lightweight popup buttons that were previously added with `#addLightweightPopupButton`.
  `Date`
  `getDate()`
  Returns the date, this value is used both for type date/date and time.
  `Picker.DateGetter`
  `getDefaultDate()`
  Returns the `DateGetter` previously installed via `setDefaultDate(DateGetter)` (or the wrapper produced by the `Date` overload), or `null` if no default has been configured.
  `long`
  `getDuration()`
  This value is used for the duration type.
  `int`
  `getDurationHours()`
  Gets the duration hours.
  `int`
  `getDurationMinutes()`
  Gets the duration minutes.
  `Date`
  `getEndDate()`
  Gets the end date of the picker.
  `SimpleDateFormat`
  `getFormatter()`
  Allows us to define a date format for the display of dates/times
  `List<String>`
  `getLightweightPopupButtonLabels()`
  Returns an immutable list of custom button labels currently configured for the lightweight popup.
  `int`
  `getMaxHour()`
  Gets the minimum hour to show for time and datetime pickers.
  `int`
  `getMinHour()`
  Gets the minimum hour to show for time and datetime pickers.
  `int`
  `getPreferredPopupHeight()`
  The preferred height of the popup dialog.
  `int`
  `getPreferredPopupWidth()`
  The preferred width of the popup dialog.
  `String[]`
  `getPropertyNames()`
  A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code
  `String[]`
  `getPropertyTypeNames()`
  This method is here to workaround an XMLVM array type bug where property types aren't identified properly, it returns the names of the types using the following type names: String,int,double,long,byte,short,char,String[],String[][],byte[],Image,Image[],Object[],ListModel,ListCellRenderer
  `Class[]`
  `getPropertyTypes()`
  Matches the property names method (see that method for further details).
  `Object`
  `getPropertyValue(String name)`
  Returns the current value of the property name, this method is used by the GUI builder
  `Object`
  `getRenderingPrototype()`
  When using a lightweight spinner this will be used as the rendering prototype
  `String`
  `getSelectedString()`
  Returns the current string.
  `int`
  `getSelectedStringIndex()`
  Returns the index of the selected string.
  `Date`
  `getStartDate()`
  Gets the start date of the picker.
  `String[]`
  `getStrings()`
  Returns the String array matching the metadata
  `Style`
  `getStyle()`
  Returns the current Component Style allowing code to draw the current component, you should normally use getUnselected/Pressed/DisabledStyle() and not this method since it will return different values based on component state.
  `int`
  `getTime()`
  This value is only used for time type and is ignored in the case of date and time where both are embedded within the date.
  `int`
  `getType()`
  Returns the type of the picker
  `Object`
  `getValue()`
  Returns the value which works for all picker types
  `static boolean`
  `isDefaultUseLightweightPopup()`
  Whether useLightweightPopup should default to true, this can be set via the theme constant `lightweightPickerBool`
  `boolean`
  `isEditable()`
  Checks to see if the component is editable.
  `boolean`
  `isEditing()`
  Checks if the component is currently being edited.
  `boolean`
  `isShowMeridiem()`
  Indicates whether hours should be rendered as AM/PM or 24hr format
  `boolean`
  `isUseLightweightPopup()`
  Checks if this picker is in lightweight mode.
  `void`
  `paint(Graphics g)`
  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.
  `void`
  `setDate(Date d)`
  Sets the date, this value is used both for type date/date and time.
  `void`
  `setDefaultDate(Picker.DateGetter getter)`
  Installs a dynamic default for `PICKER_TYPE_DATE`, `PICKER_TYPE_DATE_AND_TIME`, and `PICKER_TYPE_CALENDAR` pickers.
  `void`
  `setDefaultDate(Date d)`
  Convenience overload that pins the picker's default to a fixed date.
  `static void`
  `setDefaultUseLightweightPopup(boolean aDefaultUseLightweightPopup)`
  Whether useLightweightPopup should default to true, this can be set via the theme constant `lightweightPickerBool`
  `void`
  `setDuration(int hour, int minute)`
  Convenience method for setting duration in hours and minutes.
  `void`
  `setDuration(long duration)`
  This value is only used for duration type.
  `void`
  `setEndDate(Date end)`
  Sets the end date of the picker.
  `void`
  `setFormatter(SimpleDateFormat formatter)`
  Allows us to define a date format for the display of dates/times
  `void`
  `setHourRange(int min, int max)`
  Sets the hour range for this picker.
  `void`
  `setMinuteStep(int step)`
  Sets the minute step size for PICKER_TYPE_DURATION, and PICKER_TYPE_DURATION_TIME types.
  `void`
  `setPreferredPopupHeight(int height)`
  The preferred height of the popup dialog for the picker.
  `void`
  `setPreferredPopupWidth(int width)`
  The preferred width of the popup dialog for the picker.
  `String`
  `setPropertyValue(String name, Object value)`
  Sets a new value to the given property, returns an error message if failed and null if successful.
  `void`
  `setRenderingPrototype(Object renderingPrototype)`
  When using a lightweight spinner this will be used as the rendering prototype
  `void`
  `setSelectedString(String str)`
  Sets the current value in a string array picker.
  `void`
  `setSelectedStringIndex(int index)`
  Sets the index of the selected string.
  `void`
  `setShowMeridiem(boolean showMeridiem)`
  Indicates whether hours should be rendered as AM/PM or 24hr format
  `void`
  `setStartDate(Date start)`
  Sets the start date of the picker.
  `void`
  `setStrings(String... strs)`
  Sets the string entries for the string picker.
  `void`
  `setTime(int time)`
  This value is only used for time type and is ignored in the case of date and time where both are embedded within the date.
  `void`
  `setTime(int hour, int minute)`
  Convenience method equivalent to invoking setTime(hour * 60 + minute);
  `void`
  `setType(int type)`
  Sets the type of the picker to one of Display.PICKER_TYPE_DATE, Display.PICKER_TYPE_DATE_AND_TIME, Display.PICKER_TYPE_STRINGS, Display.PICKER_TYPE_DURATION, Display.PICKER_TYPE_DURATION_HOURS, Display.PICKER_TYPE_DURATION_MINUTES or Display.PICKER_TYPE_TIME
  `void`
  `setUseLightweightPopup(boolean useLightweightPopup)`
  Sets the picker to use lightweight mode for its widgets.
  `void`
  `startEditingAsync()`
  If the component `#isEditable()`, then this will start the editing process.
  `void`
  `stopEditing(Runnable onFinish)`
  Stops the editing process.
  `protected void`
  `updateValue()`
  Updates the display value of the picker, subclasses can override this to invoke set text with the right value

  ### Methods inherited from class Button

  `addActionListener, addStateChangeListener, animate, bindStateTo, calcPreferredSize, dragInitiated, fireActionEvent, fireClicked, getActionListeners, getBorder, getCommand, getDisabledIcon, getIconFromState, getListeners, getPressedIcon, getReleaseRadius, getRolloverIcon, getRolloverPressedIcon, getState, isAutoRelease, isButtonRippleEffectDefault, isCapsText, isCapsTextDefault, isOppositeSide, isSelectableInteraction, isSelected, isToggle, keyPressed, keyReleased, keyRepeated, pointerHover, pointerHoverReleased, pointerPressed, pointerReleased, pressed, released, released, removeActionListener, removeStateChangeListener, resetFocusable, setAlignment, setAutoRelease, setButtonRippleEffectDefault, setCapsText, setCapsTextDefault, setCommand, setDisabledIcon, setPressedIcon, setReleased, setReleaseRadius, setRolloverIcon, setRolloverPressedIcon, setText, setToggle, setUIID, unbindStateFrom`

  ### Methods inherited from class Label

  `bindProperty, getAlignment, getBadgeStyleComponent, getBadgeText, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBoundPropertyValue, getDefaultGap, getFontIcon, getFontIconSize, getGap, getIcon, getIconFont, getIconStyleComponent, getIconUIID, getMask, getMaskedIcon, getMaskName, getMaterialIcon, getMaterialIconSize, getMaxAutoSize, getMinAutoSize, getShiftMillimeters, getShiftMillimetersF, getShiftText, getStringWidth, getText, getTextPosition, getTextSelectionSupport, getVerticalAlignment, initLaf, initUnselectedStyle, isAutoSizeMode, isDefaultTickerEnabled, isEndsWith3Points, isLegacyRenderer, isShouldLocalize, isShowEvenIfBlank, isTextSelectionEnabled, isTickerEnabled, isTickerRunning, laidOut, paramString, refreshTheme, setAutoSizeMode, setBadgeText, setBadgeUIID, setBoundPropertyValue, setDefaultGap, setDefaultTickerEnabled, setEndsWith3Points, setFontIcon, setFontIcon, setFontIcon, setGap, setIcon, setIconUIID, setLegacyRenderer, setMask, setMaskName, setMaterialIcon, setMaterialIcon, setMaxAutoSize, setMinAutoSize, setShiftMillimeters, setShiftMillimeters, setShiftText, setShouldLocalize, setShowEvenIfBlank, setTextPosition, setTextSelectionEnabled, setTickerEnabled, setVerticalAlignment, shouldTickerStart, startTicker, startTicker, stopTicker, styleChanged, unbindProperty`

  ### Methods inherited from class Component

  `addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, announceForAccessibility, blocksSideSwipe, calcScrollSize, cancelRepaints, clearClientProperties, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAccessibilityText, getAllStyles, getAnimationManager, getBottomGap, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getGridPosX, getGridPosY, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getTabIndex, getTensileLength, getTooltip, getUIID, getUIManager, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, longKeyPress, longPointerPress, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHoverPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, repaint, repaint, requestFocus, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAccessibilityText, setAlwaysTensile, setBlockLead, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setPullToRefresh, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIIDFinal, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, stripMarginAndPadding, toImage, toString, updateNativeOverlay, visibleBoundsContains`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface IconHolder

  `getGap, getIcon, getIconStyleComponent, getIconUIID, getTextPosition, setFontIcon, setGap, setIcon, setIconUIID, setMaterialIcon, setTextPosition`

- ## Constructor Details

  - ### Picker

    public Picker()
    Default constructor

- ## Method Details

  - ### addLightweightPopupButton

    public void addLightweightPopupButton(String text, Runnable action)

    Adds a custom button to the lightweight picker popup in the default placement between the `Cancel` and `Done` areas.

    ###### Parameters

    - `text`: Button label.
    - `action`: Action to run when the button is pressed.

  - ### addLightweightPopupButton

    public void addLightweightPopupButton(String text, Runnable action, int placement)

    Adds a custom button to the lightweight picker popup with the default `Component#LEFT` alignment.

    ###### Parameters

    - `text`: Button label.
    - `action`: Action to run when the button is pressed.
    - `placement`: One of `LightweightPopupButtonPlacement#BETWEEN_CANCEL_AND_DONE`, `LightweightPopupButtonPlacement#ABOVE_SPINNER`, or `LightweightPopupButtonPlacement#BELOW_SPINNER`.

  - ### addLightweightPopupButton

    public void addLightweightPopupButton(String text, Runnable action, int placement, int alignment)

    Adds a custom button to the lightweight picker popup at a specific horizontal alignment within its row. Buttons that share the same `placement` and `alignment` are packed in declaration order; mixing alignments lets you put some buttons on the left and others on the right of the same row.

    ###### Parameters

    - `text`: Button label.
    - `action`: Action to run when the button is pressed.
    - `placement`: One of `LightweightPopupButtonPlacement#BETWEEN_CANCEL_AND_DONE`, `LightweightPopupButtonPlacement#ABOVE_SPINNER`, or `LightweightPopupButtonPlacement#BELOW_SPINNER`.
    - `alignment`: One of `Component#LEFT`, `Component#CENTER`, or `Component#RIGHT`.

  - ### clearLightweightPopupButtons

    public void clearLightweightPopupButtons()
    Removes all custom lightweight popup buttons that were previously added with `#addLightweightPopupButton`.

  - ### getLightweightPopupButtonLabels

    public List<String> getLightweightPopupButtonLabels()
    Returns an immutable list of custom button labels currently configured for the lightweight popup.

  - ### isDefaultUseLightweightPopup

    public static boolean isDefaultUseLightweightPopup()

    Whether useLightweightPopup should default to true, this can be set via the theme constant `lightweightPickerBool`

    ###### Returns

    the defaultUseLightweightPopup

  - ### setDefaultUseLightweightPopup

    public static void setDefaultUseLightweightPopup(boolean aDefaultUseLightweightPopup)

    Whether useLightweightPopup should default to true, this can be set via the theme constant `lightweightPickerBool`

    ###### Parameters

    - `aDefaultUseLightweightPopup`: the defaultUseLightweightPopup to set

  - ### setHourRange

    public void setHourRange(int min, int max)

    Sets the hour range for this picker. Only applicable for types `Display#PICKER_TYPE_DATE_AND_TIME` and `Display#PICKER_TYPE_TIME`. Also, only applicable to lightweight picker (i.e. `#isUseLightweightPopup()` == true.

    ###### Parameters

    - `min`: The minimum hour to display (0-24) or -1 for no limit.

    - `max`: The maximum hour to display (0-24) or -1 for no limit

    ###### Since

    6.0

    ###### See also

    - #getMinHour()

    - #getMaxHour()

  - ### getMinHour

    public int getMinHour()

    Gets the minimum hour to show for time and datetime pickers. Only applicable for types `Display#PICKER_TYPE_DATE_AND_TIME` and `Display#PICKER_TYPE_TIME`. Also, only applicable to lightweight picker (i.e. `#isUseLightweightPopup()` == true.

    ###### Returns

    The minimum hour. 0-24, or -1 for no limit.

    ###### Since

    6.0

    ###### See also

    - #getMaxHour()

    - #setHourRange(int, int)

  - ### getMaxHour

    public int getMaxHour()

    Gets the minimum hour to show for time and datetime pickers. Only applicable for types `Display#PICKER_TYPE_DATE_AND_TIME` and `Display#PICKER_TYPE_TIME`. Also, only applicable to lightweight picker (i.e. `#isUseLightweightPopup()` == true.

    ###### Returns

    The minimum hour. 0-24, or -1 for no limit.

    ###### Since

    6.0

    ###### See also

    - #getMinHour()

    - #setHourRange(int, int)

  - ### getStartDate

    public Date getStartDate()

    Gets the start date of the picker. Only applicable for types `Display#PICKER_TYPE_DATE_AND_TIME` and `Display#PICKER_TYPE_DATE`. Also, only applicable to lightweight picker (i.e. `#isUseLightweightPopup()` == true.

    ###### Returns

    Returns:

      The start date or null if there is none set.

      This does not apply to the time. Only the date. You can set the hour range using `int)`.

      ###### Since

      6.0

      ###### See also

      - #getEndDate()

      - #setStartDate(java.util.Date)

      - #getMinHour()

  - ### setStartDate

    public void setStartDate(Date start)

    Sets the start date of the picker. Only applicable for types `Display#PICKER_TYPE_DATE_AND_TIME` and `Display#PICKER_TYPE_DATE`. Also, only applicable to lightweight picker (i.e. `#isUseLightweightPopup()` == true.

    This does not affect the time. Only the date. You can set the hour range using `int)`.

    ###### Parameters

    - `start`: The start date.

    ###### Since

    6.0

    ###### See also

    - #getStartDate()

    - #setEndDate(java.util.Date)

  - ### getEndDate

    public Date getEndDate()

    Gets the end date of the picker. Only applicable for types `Display#PICKER_TYPE_DATE_AND_TIME` and `Display#PICKER_TYPE_DATE`. Also, only applicable to lightweight picker (i.e. `#isUseLightweightPopup()` == true.

    ###### Returns

    Returns:

      The end date or null if there is none set.

      This does not apply to the time. Only the date. You can set the hour range using `int)`.

      ###### Since

      6.0

      ###### See also

      - #getStartDate()

      - #setEndDate(java.util.Date)

      - #getMaxHour()

  - ### setEndDate

    public void setEndDate(Date end)

    Sets the end date of the picker. Only applicable for types `Display#PICKER_TYPE_DATE_AND_TIME` and `Display#PICKER_TYPE_DATE`. Also, only applicable to lightweight picker (i.e. `#isUseLightweightPopup()` == true.

    This does not affect the time. Only the date. You can set the hour range using `int)`.

    ###### Parameters

    - `end`: The end date.

    ###### Since

    6.0

    ###### See also

    - #setStartDate(java.util.Date)

    - #getEndDate()

  - ### isUseLightweightPopup

    public boolean isUseLightweightPopup()
    Checks if this picker is in lightweight mode. If this returns true, then the picker will use cross-platform lightweight widgets instead of native widgets.

  - ### setUseLightweightPopup

    public void setUseLightweightPopup(boolean useLightweightPopup)

    Sets the picker to use lightweight mode for its widgets. With this mode enabled the picker will use cross-platform lightweight widgets instead of native widgets.

    ###### Parameters

    - `useLightweightPopup`

  - ### startEditingAsync

    public void startEditingAsync()
    Description copied from class: `Component`

    If the component `#isEditable()`, then this will start the editing process. For TextFields, this results in showing the keyboard and allowing the user to edit the input. For the Picker, this will display the popup.

    ###### See also

    - #stopEditing(java.lang.Runnable)

    - #isEditing()

    - #isEditable()

    - #getEditingDelegate()

    - #setEditingDelegate(com.codename1.ui.Editable)

    Specified by:
      `startEditingAsync` in interface `Editable`
    Overrides:
      `startEditingAsync` in class `Component`

  - ### stopEditing

    public void stopEditing(Runnable onFinish)
    Description copied from class: `Component`

    Stops the editing process.

    ###### Parameters

    - `onFinish`: Callback called when the editing is complete.

    ###### See also

    - #startEditingAsync()

    - #isEditing()

    - #isEditable()

    - #getEditingDelegate()

    - #setEditingDelegate(com.codename1.ui.Editable)

    Specified by:
      `stopEditing` in interface `Editable`
    Overrides:
      `stopEditing` in class `Component`

  - ### isEditing

    public boolean isEditing()
    Description copied from class: `Component`

    Checks if the component is currently being edited.

    ###### Returns

    True if the component is currently being edited.

    ###### See also

    - #startEditingAsync()

    - #stopEditing(java.lang.Runnable)

    - #isEditable()

    - #getEditingDelegate()

    - #setEditingDelegate(com.codename1.ui.Editable)

    Specified by:
      `isEditing` in interface `Editable`
    Overrides:
      `isEditing` in class `Component`

  - ### isEditable

    public boolean isEditable()
    Description copied from class: `Component`

    Checks to see if the component is editable. This is used for next/previous focus traversal on forms.

    ###### See also

    - #getEditingDelegate()

    - #setEditingDelegate(com.codename1.ui.Editable)

    - #isEditing()

    - #startEditingAsync()

    - #stopEditing(java.lang.Runnable)

    Specified by:
      `isEditable` in interface `Editable`
    Overrides:
      `isEditable` in class `Component`

  - ### getType

    public int getType()

    Returns the type of the picker

    ###### Returns

    Returns:
      one of Display.PICKER_TYPE_DATE, Display.PICKER_TYPE_DATE_AND_TIME, Display.PICKER_TYPE_STRINGS, Display.PICKER_TYPE_DURATION, Display.PICKER_TYPE_DURATION_HOURS, Display.PICKER_TYPE_DURATION_MINUTES, or Display.PICKER_TYPE_TIME

  - ### setType

    public void setType(int type)

    Sets the type of the picker to one of Display.PICKER_TYPE_DATE, Display.PICKER_TYPE_DATE_AND_TIME, Display.PICKER_TYPE_STRINGS, Display.PICKER_TYPE_DURATION, Display.PICKER_TYPE_DURATION_HOURS, Display.PICKER_TYPE_DURATION_MINUTES or Display.PICKER_TYPE_TIME

    ###### Parameters

    - `type`: the type

  - ### getDate

    public Date getDate()

    Returns the date, this value is used both for type date/date and time. Notice that this value isn't used for time.

    While the lightweight popup is on screen this returns the value visible on the scroll wheels (which only becomes the committed value once the user presses Done), so a custom popup button can read it to compute a relative date. The native picker does not expose the in-progress wheel state, so while a native picker is on screen this still returns the last committed value.

    ###### Returns

    the date object

  - ### setDate

    public void setDate(Date d)

    Sets the date, this value is used both for type date/date and time. Notice that this value isn't used for time.

    If the lightweight popup is currently on screen the visible scroll wheels are also moved to the new value, so a custom popup button can do `setDate(getDate() + n)` and have the wheels reflect it (see `#addLightweightPopupButton(String, Runnable)`). Such changes are staged: if the user dismisses the popup with Cancel the picker rolls back to the date it held before the popup was shown; if the user presses Done the staged value is committed. The native picker is read-only while shown - calling `setDate` against a Picker whose native popup is open updates the committed `value` but leaves the on-screen wheels unchanged until the user dismisses and re-opens the picker.

    Passing `null` explicitly clears the picker's value: subsequent `getDate()` calls return `null` (the picker text falls back to the `...` placeholder) until either `setDate(non-null)` is called or the user opens the popup and commits a selection. A configured `setDefaultDate` getter still seeds the popup wheels on the next open so the user has a sensible starting point, but it no longer leaks into `getDate()` as an unselected value. Issue #5024.

    ###### Parameters

    - `d`: the new date, or `null` to clear the picker

  - ### setDefaultDate

    public void setDefaultDate(Picker.DateGetter getter)

    Installs a dynamic default for `PICKER_TYPE_DATE`, `PICKER_TYPE_DATE_AND_TIME`, and `PICKER_TYPE_CALENDAR` pickers. The getter is consulted every time the picker is opened or `getDate()` is called against a picker whose date has not been pinned by `setDate(Date)`, so dependent defaults (e.g. a reminder that should fire one hour before a separately-tracked due date) stay in sync with the value they depend on. Passing `null` removes the default and reverts to `new Date()`.

    ###### Parameters

    - `getter`: the supplier of the default date, or `null` to restore the framework default of `new Date()`

  - ### setDefaultDate

    public void setDefaultDate(Date d)

    Convenience overload that pins the picker's default to a fixed date. Equivalent to passing a `DateGetter` that always returns `d`. Passing `null` clears the default.

    ###### Parameters

    - `d`: the fixed default date, or `null` to restore the framework default

  - ### getDefaultDate

    public Picker.DateGetter getDefaultDate()
    Returns the `DateGetter` previously installed via `setDefaultDate(DateGetter)` (or the wrapper produced by the `Date` overload), or `null` if no default has been configured.

  - ### getStrings

    public String[] getStrings()

    Returns the String array matching the metadata

    ###### Returns

    a string array

  - ### setStrings

    public void setStrings(String... strs)

    Sets the string entries for the string picker.

    sample usage for this method below:

        Toolbar.setGlobalToolbar(true);
        Form hi = new Form("Transitions", new BoxLayout(BoxLayout.Y_AXIS));
        Style bg = hi.getContentPane().getUnselectedStyle();
        bg.setBgTransparency(255);
        bg.setBgColor(0xff0000);
        Button showTransition = new Button("Show");
        Picker pick = new Picker();
        pick.setStrings("Slide", "SlideFade", "Cover", "Uncover", "Fade", "Flip");
        pick.setSelectedString("Slide");
        TextField duration = new TextField("10000", "Duration", 6, TextArea.NUMERIC);
        CheckBox horizontal = CheckBox.createToggle("Horizontal");
        pick.addActionListener((e) -> {
            String s = pick.getSelectedString().toLowerCase();
            horizontal.setEnabled(s.equals("slide") || s.indexOf("cover") > -1);
        });
        horizontal.setSelected(true);
        hi.add(showTransition).
            add(pick).
            add(duration).
            add(horizontal);

        Form dest = new Form("Destination");
        bg = dest.getContentPane().getUnselectedStyle();
        bg.setBgTransparency(255);
        bg.setBgColor(0xff);
        dest.setBackCommand(
                dest.getToolbar().addCommandToLeftBar("Back", null, (e) -> hi.showBack()));

        showTransition.addActionListener((e) -> {
            int h = CommonTransitions.SLIDE_HORIZONTAL;
            if(!horizontal.isSelected()) {
                h = CommonTransitions.SLIDE_VERTICAL;
            }
            switch(pick.getSelectedString()) {
                case "Slide":
                    hi.setTransitionOutAnimator(CommonTransitions.createSlide(h, true, duration.getAsInt(3000)));
                    dest.setTransitionOutAnimator(CommonTransitions.createSlide(h, true, duration.getAsInt(3000)));
                    break;
                case "SlideFade":
                    hi.setTransitionOutAnimator(CommonTransitions.createSlideFadeTitle(true, duration.getAsInt(3000)));
                    dest.setTransitionOutAnimator(CommonTransitions.createSlideFadeTitle(true, duration.getAsInt(3000)));
                    break;
                case "Cover":
                    hi.setTransitionOutAnimator(CommonTransitions.createCover(h, true, duration.getAsInt(3000)));
                    dest.setTransitionOutAnimator(CommonTransitions.createCover(h, true, duration.getAsInt(3000)));
                    break;
                case "Uncover":
                    hi.setTransitionOutAnimator(CommonTransitions.createUncover(h, true, duration.getAsInt(3000)));
                    dest.setTransitionOutAnimator(CommonTransitions.createUncover(h, true, duration.getAsInt(3000)));
                    break;
                case "Fade":
                    hi.setTransitionOutAnimator(CommonTransitions.createFade(duration.getAsInt(3000)));
                    dest.setTransitionOutAnimator(CommonTransitions.createFade(duration.getAsInt(3000)));
                    break;
                case "Flip":
                    hi.setTransitionOutAnimator(new FlipTransition(-1, duration.getAsInt(3000)));
                    dest.setTransitionOutAnimator(new FlipTransition(-1, duration.getAsInt(3000)));
                    break;
            }
            dest.show();
        });
        hi.show();

    ###### Parameters

    - `strs`: string array

  - ### getSelectedString

    public String getSelectedString()

    Returns the current string. While the lightweight popup is on screen this returns the value visible on the scroll wheel; the native picker does not expose its in-progress wheel state, so while a native picker is on screen this still returns the last committed value.

    ###### Returns

    the selected string

  - ### setSelectedString

    public void setSelectedString(String str)

    Sets the current value in a string array picker. If the lightweight popup is on screen the visible scroll wheel is also moved to the new value, and the change is staged: a Cancel press rolls back to the value the picker held before the popup was shown, while a Done press commits it. The native picker is read-only while shown so against a native popup this updates only the committed value.

    ###### Parameters

    - `str`: the current value

  - ### getSelectedStringIndex

    public int getSelectedStringIndex()

    Returns the index of the selected string. While the lightweight popup is on screen this returns the index visible on the scroll wheel; the native picker still returns the last committed index.

    ###### Returns

    the selected string offset or -1

  - ### setSelectedStringIndex

    public void setSelectedStringIndex(int index)

    Sets the index of the selected string. If the lightweight popup is on screen the visible wheel is also moved to the new value, and the change is staged: a Cancel press rolls back to the value the picker held before the popup was shown, while a Done press commits it. The native picker is read-only while shown so against a native popup this updates only the committed value.

    ###### Parameters

    - `index`: sets the index of the selected string

  - ### updateValue

    protected void updateValue()
    Updates the display value of the picker, subclasses can override this to invoke set text with the right value

  - ### setTime

    public void setTime(int hour, int minute)

    Convenience method equivalent to invoking setTime(hour * 60 + minute);

    ###### Parameters

    - `hour`: the hour in 24hr format

    - `minute`: the minute within the hour

  - ### getTime

    public int getTime()

    This value is only used for time type and is ignored in the case of date and time where both are embedded within the date. While the lightweight popup is on screen this returns the value visible on the scroll wheels; the native picker still returns the last committed value.

    ###### Returns

    the time value as minutes since midnight e.g. 630 is 10:30am

  - ### setTime

    public void setTime(int time)

    This value is only used for time type and is ignored in the case of date and time where both are embedded within the date. If the lightweight popup is on screen the visible scroll wheels are also moved to the new value, and the change is staged: a Cancel press rolls back to the value the picker held before the popup was shown, while a Done press commits it. The native picker is read-only while shown so against a native popup this updates only the committed value.

    ###### Parameters

    - `time`: the time value as minutes since midnight e.g. 630 is 10:30am

  - ### setMinuteStep

    public void setMinuteStep(int step)

    Sets the minute step size for PICKER_TYPE_DURATION, and PICKER_TYPE_DURATION_TIME types.

    ###### Parameters

    - `step`: The step size in minutes.

  - ### setDuration

    public void setDuration(int hour, int minute)

    Convenience method for setting duration in hours and minutes.

    ###### Parameters

    - `hour`: The hours for duration.

    - `minute`: The minutes for duration.

    ###### See also

    - #setDuration(long)

    - #getDuration()

    - #getDurationHours()

    - #getDurationMinutes()

  - ### getDuration

    public long getDuration()

    This value is used for the duration type. While the lightweight popup is on screen this returns the value visible on the scroll wheels; the native picker still returns the last committed value.

    ###### Returns

    The duration in milliseconds.

    ###### See also

    - #getDurationHours()

    - #getDurationMinutes()

  - ### setDuration

    public void setDuration(long duration)

    This value is only used for duration type. If the lightweight popup is on screen the visible scroll wheels are also moved to the new value, and the change is staged: a Cancel press rolls back to the value the picker held before the popup was shown, while a Done press commits it. The native picker is read-only while shown so against a native popup this updates only the committed value.

    ###### Parameters

    - `duration`: The duration value in milliseconds.

    ###### See also

    - #setDuration(int, int)

    - #getDuration()

    - #getDurationHours()

    - #getDurationMinutes()

  - ### getDurationHours

    public int getDurationHours()

    Gets the duration hours. Used only for duration type.

    ###### Returns

    The duration hours.

    ###### See also

    - #getDurationMinutes()

    - #getDuration()

  - ### getDurationMinutes

    public int getDurationMinutes()

    Gets the duration minutes. Used only for duration type.

    ###### Returns

    The duration minutes.

    ###### See also

    - #getDurationHours()

    - #getDuration()

  - ### isShowMeridiem

    public boolean isShowMeridiem()

    Indicates whether hours should be rendered as AM/PM or 24hr format

    ###### Returns

    the showMeridiem

  - ### setShowMeridiem

    public void setShowMeridiem(boolean showMeridiem)

    Indicates whether hours should be rendered as AM/PM or 24hr format

    ###### Parameters

    - `showMeridiem`: the showMeridiem to set

  - ### getRenderingPrototype

    public Object getRenderingPrototype()

    When using a lightweight spinner this will be used as the rendering prototype

    ###### Returns

    the renderingPrototype

  - ### setRenderingPrototype

    public void setRenderingPrototype(Object renderingPrototype)

    When using a lightweight spinner this will be used as the rendering prototype

    ###### Parameters

    - `renderingPrototype`: the renderingPrototype to set

  - ### getFormatter

    public SimpleDateFormat getFormatter()

    Allows us to define a date format for the display of dates/times

    ###### Returns

    the defined formatter

  - ### setFormatter

    public void setFormatter(SimpleDateFormat formatter)

    Allows us to define a date format for the display of dates/times

    ###### Parameters

    - `formatter`: the new formatter

  - ### getPreferredPopupWidth

    public int getPreferredPopupWidth()
    The preferred width of the popup dialog. This will only be used on devices where the popup width and height are configurable, such as the iPad or tablets. On iPhone, the picker always spans the width of the screen along the bottom.

  - ### setPreferredPopupWidth

    public void setPreferredPopupWidth(int width)

    The preferred width of the popup dialog for the picker. This will only be used on devices where the popup width and height are configurable, such as the iPad or tablets. On iPhone, the picker always spans the width of the screen along the bottom.

    ###### Parameters

    - `width`: The preferred width of the popup.

  - ### getPreferredPopupHeight

    public int getPreferredPopupHeight()
    The preferred height of the popup dialog. This will only be used on devices where the popup width and height are configurable, such as the iPad or tablets. On iPhone, the picker always spans the width of the screen along the bottom.

  - ### setPreferredPopupHeight

    public void setPreferredPopupHeight(int height)

    The preferred height of the popup dialog for the picker. This will only be used on devices where the popup width and height are configurable, such as the iPad or tablets. On iPhone, the picker always spans the width of the screen along the bottom.

    ###### Parameters

    - `height`: The preferred height of the popup.

  - ### getPropertyNames

    public String[] getPropertyNames()

    A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code

    ###### Returns

    the property names allowing mutation

    Overrides:
      `getPropertyNames` in class `Label`

  - ### getPropertyTypes

    public Class[] getPropertyTypes()

    Matches the property names method (see that method for further details).

    ###### Returns

    the types of the properties

    Overrides:
      `getPropertyTypes` in class `Label`

  - ### getPropertyTypeNames

    public String[] getPropertyTypeNames()

    This method is here to workaround an XMLVM array type bug where property types aren't identified properly, it returns the names of the types using the following type names: String,int,double,long,byte,short,char,String[],String[][],byte[],Image,Image[],Object[],ListModel,ListCellRenderer

    ###### Returns

    Array of type names

    Overrides:
      `getPropertyTypeNames` in class `Label`

  - ### getPropertyValue

    public Object getPropertyValue(String name)

    Returns the current value of the property name, this method is used by the GUI builder

    ###### Parameters

    - `name`: the name of the property

    ###### Returns

    the value of said property

    Overrides:
      `getPropertyValue` in class `Label`

  - ### setPropertyValue

    public String setPropertyValue(String name, Object value)

    Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as "$designMode" might be sent to components to indicate application state.

    ###### Parameters

    - `name`: the name of the property

    - `value`: new value for the property

    ###### Returns

    error message or null

    Overrides:
      `setPropertyValue` in class `Label`

  - ### getValue

    public Object getValue()

    Returns the value which works for all picker types

    ###### Returns

    the value object

  - ### paint

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

    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 `Button`

  - ### getStyle

    public Style getStyle()
    Description copied from class: `Component`

    Returns the current Component Style allowing code to draw the current component, you should normally use getUnselected/Pressed/DisabledStyle() and not this method since it will return different values based on component state.

    ###### Returns

    the component Style object

    Overrides:
      `getStyle` in class `Component`