public class Calendar extends Container
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, 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, LEFT, RIGHT, TOP
Constructor and Description |
---|
Calendar()
Constructs a calendar with the current date and time
|
Calendar(long time)
Creates a new instance of Calendar set to the given date based on time
since epoch (the java.util.Date convention)
|
Calendar(long time,
TimeZone tmz)
Creates a new instance of Calendar set to the given date based on time
since epoch (the java.util.Date convention)
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener l)
Fires when a change is made to the month view of this component
|
void |
addDataChangeListener(DataChangedListener l)
Allows tracking selection changes in the calendar in real time
|
protected Button |
createDay()
This method creates the Day Button Component for the Month View
|
protected Label |
createDayTitle(int day)
This method creates the Day title Component for the Month View
|
Date |
getCurrentDate()
Returns the currently viewed date (as opposed to the selected date)
|
Date |
getDate()
Return the date object matching the current selection
|
Style |
getMonthViewSelectedStyle()
Gets the selected style of the month view component within the calendar
|
Style |
getMonthViewUnSelectedStyle()
Gets the un selected style of the month view component within the calendar
|
long |
getSelectedDay()
Returns the time for the current calendar.
|
TimeZone |
getTimeZone()
Gets the Calendar timezone
|
boolean |
isChangesSelectedDateEnabled()
This flag determines if selected date can be changed by selecting an
alternative date
|
void |
removeActionListener(ActionListener l)
Fires when a change is made to the month view of this component
|
void |
removeDataChangeListener(DataChangedListener l)
Allows tracking selection changes in the calendar in real time
|
void |
setChangesSelectedDateEnabled(boolean changesSelectedDateEnabled)
This flag determines if selected date can be changed by selecting an
alternative date
|
void |
setCurrentDate(Date d)
Sets the Calendar view on the given date, only the the month and year
are being considered.
|
void |
setDate(Date d)
Sets the current date in the view and the selected date to be the same.
|
void |
setMonthViewSelectedStyle(Style s)
Sets the selected style of the month view component within the calendar
|
void |
setMonthViewUnSelectedStyle(Style s)
Sets the un selected style of the month view component within the calendar
|
void |
setSelectedDate(Date d)
This method sets the Calendar selected day
|
void |
setTimeZone(TimeZone tmz)
Sets the Calendar timezone, if not specified Calendar will use the
default timezone
|
void |
setYearRange(int minYear,
int maxYear)
Sets the Calendar min and max years
|
protected void |
updateButtonDayDate(Button dayButton,
int currentMonth,
int day)
This method updates the Button day.
|
protected void |
updateButtonDayDate(Button dayButton,
int year,
int currentMonth,
int day)
This method updates the Button day.
|
addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, contains, createAnimateMotion, dragInitiated, drop, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isScrollableX, isScrollableY, isSelectableInteraction, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintComponentBackground, paintGlass, paramString, pointerHover, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager
addDragOverListener, addDropListener, addFocusListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, animate, bindProperty, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isCellRenderer, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInClippingRegion, isInitialized, isRTL, isScrollable, isScrollVisible, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pinch, pointerDragged, pointerDragged, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, removeDragOverListener, removeDropListener, removeFocusListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, repaint, repaint, requestFocus, resetFocusable, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setSameHeight, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, styleChanged, toString, unbindProperty
public Calendar(long time)
time
- time since epochpublic Calendar()
public Calendar(long time, TimeZone tmz)
time
- time since epochtmz
- a reference timezonepublic long getSelectedDay()
public Date getDate()
public void setDate(Date d)
d
- new datepublic void setYearRange(int minYear, int maxYear)
minYear
- the min yearmaxYear
- the max yearpublic void setSelectedDate(Date d)
d
- the selected daypublic void setCurrentDate(Date d)
d
- the date to set the calendar view on.public Date getCurrentDate()
public void setTimeZone(TimeZone tmz)
tmz
- the timezonepublic TimeZone getTimeZone()
public void setMonthViewSelectedStyle(Style s)
s
- style for the month viewpublic void setMonthViewUnSelectedStyle(Style s)
s
- style for the month viewpublic Style getMonthViewSelectedStyle()
public Style getMonthViewUnSelectedStyle()
public void addActionListener(ActionListener l)
l
- listener to addpublic void removeActionListener(ActionListener l)
l
- listener to removepublic void addDataChangeListener(DataChangedListener l)
l
- listener to addpublic void removeDataChangeListener(DataChangedListener l)
l
- listener to removepublic void setChangesSelectedDateEnabled(boolean changesSelectedDateEnabled)
changesSelectedDateEnabled
- if true pressing on a date will cause
the selected date to be changed to the pressed onepublic boolean isChangesSelectedDateEnabled()
protected Button createDay()
protected Label createDayTitle(int day)
day
- the relevant day values are 0-6 where 0 is sunday.protected void updateButtonDayDate(Button dayButton, int year, int currentMonth, int day)
dayButton
- the button to be updatedday
- the new button dayprotected void updateButtonDayDate(Button dayButton, int currentMonth, int day)
dayButton
- the button to be updatedday
- the new button day