public class DateTimeSelector extends JPanel implements PropertyChangeListener
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected JAnalogClock |
mAnalogClock |
protected DateChanger |
mDateChanger |
protected JPopupMenu |
mDateTimePopup |
protected JButton |
mDateTimePopupInvoker |
protected JTextField |
mDatetimeTF |
protected JPanel |
mLeftPanel |
protected MiniCal |
mMiniCal |
protected boolean |
mNormalizeYear |
protected JPanel |
mRightPanel |
protected TimeChanger |
mTimeChanger |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
DateTimeSelector()
Creates a new DateTimeSelector instance comprised of a JTextField and
an selectable icon to the right of the JTextField.
|
DateTimeSelector(boolean showTime)
Creates a new DateTimeSelector instance comprised of a JTextField and
an selectable icon to the right of the JTextField.
|
DateTimeSelector(boolean showTime,
boolean timeOptional)
Creates a new DateTimeSelector instance comprised of a JTextField and
an selectable icon to the right of the JTextField.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener l)
Adds a change listener to the textfield
|
Color |
getBackground()
Gets the TextField's background color
|
Color |
getClockBackgroundColor()
Retrieves the clock background color
|
String |
getDateOnlyPattern()
Returns the date only format which is shown when the
"Specify time of day" checkbox deselected
|
Date |
getDateTime()
Retrieves the current date represented by this component.
|
Color |
getForeground()
Gets the TextField's Foreground color
|
int |
getHour()
Gets the hour displayed by the clock
|
Color |
getHourHandColor()
Retrieves the hour hand color
|
int |
getHourOffset()
Retrieves the Hour offset value
|
Color |
getHoursDotColor()
Retrieves the hours dot color
|
Color |
getMinuteHandColor()
Retrieves the minute hand color
|
int |
getMinutes()
Gets the minutes displayed by the clock
|
Color |
getMinutesDotColor()
Retrieves the Minutes dot color
|
int |
getMinutesOffset()
Retrieves the Minute offset value
|
String |
getPattern()
Retrieves the date pattern used to render the date into the textfield
|
Color |
getSecondHandColor()
Retrieves the second hand color
|
int |
getSeconds()
Gets the seconds displayed by the clock
|
int |
getSecondsOffset()
Retrieves the Seconds offset value
|
Color |
getSelectedDateColor()
Retrieves the color representing the user selected date
|
boolean |
getShowPatternTip()
Indicates if the tooltip is displayed or not.
|
String |
getText()
Retrieves the contents of the date/time textfield.
|
Color |
getTodayColor()
Retrieves the color representing "today"
|
void |
hidePopup()
Provides a way to force the pop-up to hide
|
boolean |
isEditable()
Returns true if component is editable
|
boolean |
isTimeOptional()
returns true if time is optional else false
|
boolean |
isTimeSpecified()
Returns whether "Specify Time of Day" option selected or not.
|
void |
paintComponent(Graphics g)
Repaints the component
|
void |
propertyChange(PropertyChangeEvent e)
Watch for user selection date changes from the AnalogClock component or the minical component
|
void |
removeChangeListener(ChangeListener l)
Removes a change listener from the textbox
|
void |
requestFocus()
Override requestFocus to pass it on to the actual text field
|
void |
setAccessibleName(String s) |
void |
setAccessibleParent(Accessible parent) |
void |
setBackground(Color bg)
Sets the TextField's background color
|
void |
setClockBackgroundColor(Color c)
Change the background color of the clock.
|
void |
setDateOnlyPattern(String dateOnlyPattern)
Sets the date only format which is shown when the
"Specify time of day" checkbox deselected
|
void |
setDateTime(Date d)
Establishes the current date and time represented by this component
|
void |
setEditable(boolean editable)
Set editability of component
|
void |
setEnabled(boolean b)
Enables/disables the subcomponents that comprise the main component
|
void |
setForeground(Color fc)
Sets the TextField's foreground color
|
void |
setHour(int value)
Sets the hour to be displayed by the clock
|
void |
setHourHandColor(Color c)
Change the hour hand color of the clock.
|
void |
setHourOffset(int value)
Changes the number of hours to offset the clock by.
|
void |
setHoursDotColor(Color c)
Change the hours dot color of the clock.
|
void |
setMinuteHandColor(Color c)
Change the minute hand color of the clock.
|
void |
setMinutes(int value)
Sets the minutes to be displayed by the clock
|
void |
setMinutesDotColor(Color c)
Change the Minutes dot color of the clock.
|
void |
setMinutesOffset(int value)
Changes the number of minutes to offset the clock by.
|
void |
setPattern(String p) |
void |
setSecondHandColor(Color c)
Change the second hand color of the clock.
|
void |
setSeconds(int value)
Sets the seconds to be displayed by the clock
|
void |
setSecondsOffset(int value)
Changes the number of Seconds to offset the clock by.
|
void |
setSelectedDateColor(Color c)
Change the color representing the user selected date.
|
void |
setShowPatternTip(boolean b)
Turns on/off the tooltip displaying the current date pattern.
|
void |
setText(String dateText)
Sets the contents of the date/time textfield.
|
void |
setTimeOptional(boolean timeOptional)
Sets whether the time is optional or not
|
void |
setTimeSpecified(boolean timeSpecified)
This will selects or deselects the "Specify Time of Day" checkbox
based on the the boolean value passed
|
void |
setTodayColor(Color c)
Change the color representing "today".
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected JTextField mDatetimeTF
protected JButton mDateTimePopupInvoker
protected JPopupMenu mDateTimePopup
protected JAnalogClock mAnalogClock
protected MiniCal mMiniCal
protected boolean mNormalizeYear
protected TimeChanger mTimeChanger
protected DateChanger mDateChanger
protected JPanel mLeftPanel
protected JPanel mRightPanel
public DateTimeSelector()
public DateTimeSelector(boolean showTime)
showDate
- determines if today's date is displayed in the
textfield initially. If showDate is false, the textfield is initially
blank and the tooltip (containing the date pattern) is turned on.public DateTimeSelector(boolean showTime, boolean timeOptional)
showDate
- determines if today's date is displayed in the
textfield initially. If showDate is false, the textfield is initially
blank and the tooltip (containing the date pattern) is turned on.timeOptional
- determines whether the time part is optional.
if timeOptional is true, a check box by name "Specify time of day" will
be displayed.public void hidePopup()
public void requestFocus()
requestFocus
in class JComponent
public Color getBackground()
getBackground
in class Component
public void setBackground(Color bg)
setBackground
in class JComponent
bg
- Color to set background topublic Color getForeground()
getForeground
in class Component
public void setForeground(Color fc)
setForeground
in class JComponent
FC
- color to set the foreground topublic void addChangeListener(ChangeListener l)
l
- changeListener to addpublic void removeChangeListener(ChangeListener l)
l
- changeListener to removepublic void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- - graphics to paint onpublic void setShowPatternTip(boolean b)
b
- the flag dictating if the tooltip should be on or offpublic void setEditable(boolean editable)
editable
- New editable flagpublic boolean isEditable()
public boolean getShowPatternTip()
public String getPattern()
public void setPattern(String p)
public void setTimeOptional(boolean timeOptional)
timeOptional
- determines whether the time part is optional.
if timeOptional is true, a check box by name "Specify time of day" will
be displayed. User can make time option by deselecting the check box.public boolean isTimeOptional()
public boolean isTimeSpecified()
public void setTimeSpecified(boolean timeSpecified)
timeSpecified
- true means selects "Specify time of day" checkbox, false
will deselectspublic String getDateOnlyPattern()
public void setDateOnlyPattern(String dateOnlyPattern)
dateOnlyPattern
- date only formatpublic String getText()
public void setText(String dateText)
dateText
- the string to set in the date/time textfield - Does not change the date displayed.
To change the date/time that is displayed in the pop-up/ use setDateTimecom.portal.pfc.ui.DateTimeSelector#setDateTime
public Date getDateTime() throws IllegalArgumentException
IllegalArgumentException
public void setDateTime(Date d)
d
- the new datepublic void setHour(int value)
value
- the number representing the current hourpublic int getHour()
public void setMinutes(int value)
value
- the number representing the current minutespublic int getMinutes()
public void setSeconds(int value)
value
- the number representing the current secondspublic int getSeconds()
public void setClockBackgroundColor(Color c)
c
- the new background colorpublic Color getClockBackgroundColor()
public void setHourHandColor(Color c)
c
- the new hour hand colorpublic Color getHourHandColor()
public void setMinuteHandColor(Color c)
c
- the new minute hand colorpublic Color getMinuteHandColor()
public void setSecondHandColor(Color c)
c
- the new second hand colorpublic Color getSecondHandColor()
public void setHoursDotColor(Color c)
c
- the new hours dot colorpublic Color getHoursDotColor()
public void setMinutesDotColor(Color c)
c
- the new Minutes dot colorpublic Color getMinutesDotColor()
public void setHourOffset(int value)
value
- the number of hours to offset the clock by. Valid values are +24 to -24.public int getHourOffset()
public void setMinutesOffset(int value)
value
- the number of minutes to offset the clock by. Valid values are +60 to -60.public int getMinutesOffset()
public void setSecondsOffset(int value)
value
- the number of Seconds to offset the clock by. Valid values are +60 to -60.public int getSecondsOffset()
public void setTodayColor(Color c)
c
- the new today colorpublic Color getTodayColor()
public void setSelectedDateColor(Color c)
c
- the new current date colorpublic Color getSelectedDateColor()
public void setEnabled(boolean b)
setEnabled
in class JComponent
b
- If true, the component is enabled; otherwise it is disabled.public void propertyChange(PropertyChangeEvent e)
propertyChange
in interface PropertyChangeListener
e
- property change eventpublic void setAccessibleName(String s)
public void setAccessibleParent(Accessible parent)
Copyright © 2003, 2023, Oracle and/or its affiliates.