Class TimeSpinner3D
- All Implemented Interfaces:
Animation, Editable, StyleListener, InternalPickerWidget, Iterable<Component>
Hour and minute wheels selecting a time of day, in either 24 hour or AM/PM
form according to #setShowMeridiem(boolean).
The body of a lightweight Picker of type
time, and usable on its own as an ordinary Container. The minute wheel
can step by more than one minute, which is what a picker offering quarter
hours uses.
With #setDurationMode(boolean) set it selects a LENGTH of time instead,
and the meridiem is not shown; prefer
DurationSpinner3D for that,
which also offers a day wheel.
getValue() and setValue(Object) carry
the time as minutes since midnight, as an Integer.
-
Field Summary
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected DimensionCalculates the preferred size based on component content.intThe hour from 1-12 or 0-23intReturns
intGets the current maximum hour to display.intGets the current minimum hour to display.intGets the minutes spinner step size.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 codeClass[]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 buildergetValue()The currently selected value.booleanReturns
booleanDuration mode uses the time spinner to indicate a duration in hours and minutesbooleanReturns
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.voidsetCurrentHour(int currentHour) Set the hour from 1-12 or 0-23voidsetCurrentMeridiem(boolean currentMeridiem) Parameters
voidsetCurrentMinute(int currentMinute) Parameters
voidsetDurationMode(boolean durationMode) Duration mode uses the time spinner to indicate a duration in hours and minutesvoidsetHourRange(int min, int max) Sets the hours range to display.voidsetHoursVisible(boolean visible) Show or hide the hours spinner.voidsetMinuteStep(int minuteStep) Sets the step-size for the minutes spinner.voidsetMinutesVisible(boolean visible) Show or hide the minutes spinner.setPropertyValue(String name, Object value) Sets a new value to the given property, returns an error message if failed and null if successful.voidsetShowMeridiem(boolean showMeridiem) Shows AM/PM indicationvoidMoves the selection tovalue.Methods inherited from class Container
add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paintComponentBackground, paintGlass, paramString, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndicesMethods inherited from class Component
accessibilityChanged, accessibilityChanged, addContextMenuListener, addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addMouseWheelListener, addNativeDragOverListener, addNativeDropListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, addStylusListener, animate, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, canAcceptNativeDrop, consumesRawTextInput, contains, containsOrOwns, createNativeDragOperation, createStyleAnimation, deinitialize, deinitializeCustomStyle, deregisterFromAnimation, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAcceptedDropActions, getAcceptedDropMimeTypes, getAccessibilityNode, getAccessibilityText, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getContextMenuCommands, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getHoverStyle, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeDragOperation, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyTypeNames, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSemantics, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getTopLevelContainer, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isHovered, isHScrollThumbGrabbed, isHScrollThumbHover, isIgnorePointerEvents, isInClippingRegion, isInitialized, isNativeDragSource, isNativeDropTarget, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, isVScrollThumbGrabbed, isVScrollThumbHover, keyRepeated, laidOut, longKeyPress, longPointerPress, mouseWheel, nativeDragEnter, nativeDragExit, nativeDragOver, nativeDrop, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, registerForAnimation, remove, removeContextMenuListener, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removeMouseWheelListener, removeNativeDragOverListener, removeNativeDropListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, removeStylusListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, rotation, scrollRectToVisible, scrollRectToVisible, setAcceptedDropActions, setAcceptedDropMimeTypes, setAccessibilityText, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setContextMenuCommands, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setHorizontalScrollBounds, setHovered, setHoverStyle, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNativeDragOperation, setNativeDragSource, setNativeDropTarget, 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, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUIIDFinal, setUnselectedStyle, setVerticalScrollBounds, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stopScrollMomentum, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains
-
Constructor Details
-
TimeSpinner3D
public TimeSpinner3D(int minuteStep) Default constructor -
TimeSpinner3D
public TimeSpinner3D()
-
-
Method Details
-
calcPreferredSize
Description copied from class:ContainerCalculates the preferred size based on component content. This method is invoked lazily by getPreferred size.
Returns
the calculated preferred size based on component content
- Overrides:
calcPreferredSizein classContainer
-
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 classComponent
-
getPropertyTypes
Matches the property names method (see that method for further details).
Returns
the types of the properties
- Overrides:
getPropertyTypesin classComponent
-
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 classComponent
-
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 classComponent
-
-
getMinuteStep
public int getMinuteStep()Gets the minutes spinner step size.
Returns
the minuteStep
-
setMinuteStep
public void setMinuteStep(int minuteStep) Sets the step-size for the minutes spinner.
Parameters
minuteStep: The step size. Must be beween 1 and 60.
-
setHourRange
public void setHourRange(int min, int max) Sets the hours range to display. Note that the spinner must not be in duration mode, and must by in 24 hour mode, otherwise this will thrown an
IllegalStateException.Parameters
-
min: The minimum hour to display (0-24). Set to -1 to allow any minimum. -
nax: The maximum hour to display (0-24). Set -1 to allow any maximum.
Throws
IllegalStateException: If the spinner is not in 24 hour mode.
See also
-
#getMinHour()
-
#getMaxHour()
-
-
getMinHour
public int getMinHour()Gets the current minimum hour to display. -1 for no limit
Returns
The current minimum hour (0-24). -1 for no limit.
See also
-
#setHourRange(int, int)
-
#getMaxHour()
-
-
getMaxHour
public int getMaxHour()Gets the current maximum hour to display. -1 for no limit.
Returns
The current maximum hour (0-24). -1 for no limit.
See also
-
#getMinHour()
-
#setHourRange(int, int)
-
-
isShowMeridiem
public boolean isShowMeridiem()Returns
the showMeridiem
-
setShowMeridiem
public void setShowMeridiem(boolean showMeridiem) Shows AM/PM indication
Parameters
showMeridiem: the showMeridiem to set
-
getCurrentHour
public int getCurrentHour()The hour from 1-12 or 0-23
Returns
the currentHour
-
setCurrentHour
public void setCurrentHour(int currentHour) Set the hour from 1-12 or 0-23
Parameters
currentHour: the currentHour to set
-
getCurrentMinute
public int getCurrentMinute()Returns
the currentMinute
-
setCurrentMinute
public void setCurrentMinute(int currentMinute) Parameters
currentMinute: the currentMinute to set
-
isCurrentMeridiem
public boolean isCurrentMeridiem()Returns
the currentMeridiem
-
setCurrentMeridiem
public void setCurrentMeridiem(boolean currentMeridiem) Parameters
currentMeridiem: the currentMeridiem to set
-
isDurationMode
public boolean isDurationMode()Duration mode uses the time spinner to indicate a duration in hours and minutes
Returns
the durationMode
-
setDurationMode
public void setDurationMode(boolean durationMode) Duration mode uses the time spinner to indicate a duration in hours and minutes
Parameters
durationMode: the durationMode to set
-
setHoursVisible
public void setHoursVisible(boolean visible) Show or hide the hours spinner.
Parameters
visible: True to show the hours spinner.
-
setMinutesVisible
public void setMinutesVisible(boolean visible) Show or hide the minutes spinner.
Parameters
visible: True to make the minutes spinner visible.
-
getValue
Description copied from interface:InternalPickerWidgetThe currently selected value.
Returns
the selection, in whatever type this implementation documents; never null once the widget has been laid out
- Specified by:
getValuein interfaceInternalPickerWidget
-
setValue
Description copied from interface:InternalPickerWidgetMoves 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:
setValuein interfaceInternalPickerWidget
-
paint
Description copied from class:ContainerThis 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
-