Class Picker
- All Implemented Interfaces:
Animation, Editable, ActionSource<ActionEvent>, StyleListener, IconHolder, ReleasableComponent, SelectableIconHolder, TextHolder
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();
-
Field Summary
Fields inherited from class Button
STATE_DEFAULT, STATE_PRESSED, STATE_ROLLOVERFields 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 -
Method Summary
Modifier and TypeMethodDescriptiongetDate()Returns the date, this value is used both for type date/date and time.longThis value is used for the duration type.intGets the duration hours.intGets the duration minutes.Gets the end date of the picker.Allows us to define a date format for the display of dates/timesintGets the minimum hour to show for time and datetime pickers.intGets the minimum hour to show for time and datetime pickers.intThe preferred height of the popup dialog.intThe preferred width of the popup dialog.String[]A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder codeString[]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,ListCellRendererClass[]Matches the property names method (see that method for further details).getPropertyValue(String name) Returns the current value of the property name, this method is used by the GUI builderWhen using a lightweight spinner this will be used as the rendering prototypeReturns the current stringintReturns the index of the selected stringGets the start date of the picker.String[]Returns the String array matching the metadatagetStyle()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.intgetTime()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.intgetType()Returns the type of the pickergetValue()Returns the value which works for all picker typesstatic booleanWhether useLightweightPopup should default to true, this can be set via the theme constantlightweightPickerBoolbooleanChecks to see if the component is editable.booleanChecks if the component is currently being edited.booleanIndicates whether hours should be rendered as AM/PM or 24hr formatbooleanChecks if this picker is in lightweight mode.voidThis 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.voidSets the date, this value is used both for type date/date and time.static voidsetDefaultUseLightweightPopup(boolean aDefaultUseLightweightPopup) Whether useLightweightPopup should default to true, this can be set via the theme constantlightweightPickerBoolvoidsetDuration(int hour, int minute) Convenience method for setting duration in hours and minutes.voidsetDuration(long duration) This value is only used for duration type.voidsetEndDate(Date end) Sets the end date of the picker.voidsetFormatter(SimpleDateFormat formatter) Allows us to define a date format for the display of dates/timesvoidsetHourRange(int min, int max) Sets the hour range for this picker.voidsetMinuteStep(int step) Sets the minute step size for PICKER_TYPE_DURATION, and PICKER_TYPE_DURATION_TIME types.voidsetPreferredPopupHeight(int height) The preferred height of the popup dialog for the picker.voidsetPreferredPopupWidth(int width) The preferred width of the popup dialog for the picker.setPropertyValue(String name, Object value) Sets a new value to the given property, returns an error message if failed and null if successful.voidsetRenderingPrototype(Object renderingPrototype) When using a lightweight spinner this will be used as the rendering prototypevoidsetSelectedString(String str) Sets the current value in a string array pickervoidsetSelectedStringIndex(int index) Returns the index of the selected stringvoidsetShowMeridiem(boolean showMeridiem) Indicates whether hours should be rendered as AM/PM or 24hr formatvoidsetStartDate(Date start) Sets the start date of the picker.voidsetStrings(String... strs) Sets the string entries for the string picker.voidsetTime(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.voidsetTime(int hour, int minute) Convenience method equivalent to invoking setTime(hour * 60 + minute);voidsetType(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_TIMEvoidsetUseLightweightPopup(boolean useLightweightPopup) Sets the picker to use lightweight mode for its widgets.voidIf the component#isEditable(), then this will start the editing process.voidstopEditing(Runnable onFinish) Stops the editing process.protected voidUpdates the display value of the picker, subclasses can override this to invoke set text with the right valueMethods 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, unbindStateFromMethods 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, unbindPropertyMethods 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, 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, visibleBoundsContainsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IconHolder
getGap, getIcon, getIconStyleComponent, getIconUIID, getTextPosition, setFontIcon, setGap, setIcon, setIconUIID, setMaterialIcon, setTextPosition
-
Constructor Details
-
Picker
public Picker()Default constructor
-
-
Method Details
-
isDefaultUseLightweightPopup
public static boolean isDefaultUseLightweightPopup()Whether useLightweightPopup should default to true, this can be set via the theme constant
lightweightPickerBoolReturns
the defaultUseLightweightPopup
-
setDefaultUseLightweightPopup
public static void setDefaultUseLightweightPopup(boolean aDefaultUseLightweightPopup) Whether useLightweightPopup should default to true, this can be set via the theme constant
lightweightPickerBoolParameters
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_TIMEandDisplay#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_TIMEandDisplay#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_TIMEandDisplay#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
Gets the start date of the picker. Only applicable for types
Display#PICKER_TYPE_DATE_AND_TIMEandDisplay#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
Sets the start date of the picker. Only applicable for types
Display#PICKER_TYPE_DATE_AND_TIMEandDisplay#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
Gets the end date of the picker. Only applicable for types
Display#PICKER_TYPE_DATE_AND_TIMEandDisplay#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
Sets the end date of the picker. Only applicable for types
Display#PICKER_TYPE_DATE_AND_TIMEandDisplay#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:ComponentIf 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:
startEditingAsyncin interfaceEditable- Overrides:
startEditingAsyncin classComponent
-
-
stopEditing
Description copied from class:ComponentStops 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:
stopEditingin interfaceEditable- Overrides:
stopEditingin classComponent
-
isEditing
public boolean isEditing()Description copied from class:ComponentChecks 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)
-
-
isEditable
public boolean isEditable()Description copied from class:ComponentChecks 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:
isEditablein interfaceEditable- Overrides:
isEditablein classComponent
-
-
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
Returns the date, this value is used both for type date/date and time. Notice that this value isn't used for time
Returns
the date object
-
setDate
Sets the date, this value is used both for type date/date and time. Notice that this value isn't used for time. Notice that this value will have no effect if the picker is currently showing.
Parameters
d: the new date
-
getStrings
Returns the String array matching the metadata
Returns
a string array
-
setStrings
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
Returns the current string
Returns
the selected string
-
setSelectedString
Sets the current value in a string array picker
Parameters
str: the current value
-
getSelectedStringIndex
public int getSelectedStringIndex()Returns the index of the selected string
Returns
the selected string offset or -1
-
setSelectedStringIndex
public void setSelectedStringIndex(int index) Returns the index of the selected string
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.
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.
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.
Returns
The duration in milliseconds.
See also
-
#getDurationHours()
-
#getDurationMinutes()
-
-
setDuration
public void setDuration(long duration) This value is only used for duration type.
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
When using a lightweight spinner this will be used as the rendering prototype
Returns
the renderingPrototype
-
setRenderingPrototype
When using a lightweight spinner this will be used as the rendering prototype
Parameters
renderingPrototype: the renderingPrototype to set
-
getFormatter
Allows us to define a date format for the display of dates/times
Returns
the defined formatter
-
setFormatter
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
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:
getPropertyNamesin classLabel
-
getPropertyTypes
Matches the property names method (see that method for further details).
Returns
the types of the properties
- Overrides:
getPropertyTypesin classLabel
-
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:
getPropertyTypeNamesin classLabel
-
getPropertyValue
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:
getPropertyValuein classLabel
-
setPropertyValue
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:
setPropertyValuein classLabel
-
-
getValue
Returns the value which works for all picker types
Returns
the value object
-
paint
Description copied from class:LabelThis 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
-
getStyle
Description copied from class:ComponentReturns 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
-