|
Java Date Picker v3.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.standbysoft.component.date.swing.JDateComponent
com.standbysoft.component.date.swing.JDateEditComponent
JDateEditComponent is the base class for all date editing
components. By default, dates are edited using an internal editor that forces
users to type correct dates according to a standard
or custom date format.
The component can also accept free text
entries that are converted to dates using a date parser.
This makes it possible to plug special parsers that can convert shortcut
strings like 'today' to an appropriate date. If you are using the structured
date editor (freeText is false), then you can enable or disable
the autoCentury property. If set to
true, short years like 80 will be converted to long ones like 1980.
An important part of this component's API is reserved for date validation.
You can test if a date is valid,
execute your own action when the date is invalid and
ask for a certain edit to be commited. For a date to be
valid, it must be accepted by the date selection model. A date edit component
can be configured to indicate what must happen at validation time. Such
properties are:
| Nested Class Summary |
| Nested classes inherited from class com.standbysoft.component.date.swing.JDateComponent |
JDateComponent.DateAction, JDateComponent.RollDateAction, JDateComponent.SelectFirstDayAction, JDateComponent.SelectLastDayAction, JDateComponent.SelectNoneAction, JDateComponent.SelectTodayAction |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
protected boolean |
autoRestore
|
protected boolean |
autoValidate
|
protected boolean |
beepOnError
|
protected java.lang.String |
customDateFormat
|
protected int |
dateFormat
|
protected DateModel |
dateModel
|
protected DateListener |
dateModelListener
|
protected DateParser |
dateParser
|
protected java.lang.String |
emptySelectionText
|
protected boolean |
freeText
|
protected java.lang.String |
text
|
| Fields inherited from class com.standbysoft.component.date.swing.JDateComponent |
actionCommand, dateSelectionModel, dateSelectionModelListener, locale, selectFirstDayAction, selectLastDayAction, selectNextDayAction, selectNoneAction, selectPreviousDayAction, selectSameDayNextMonthAction, selectSameDayNextWeekAction, selectSameDayNextYearAction, selectSameDayPreviousMonthAction, selectSameDayPreviousWeekAction, selectSameDayPreviousYearAction, selectTodayAction |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
JDateEditComponent()
Creates a default date field that has the today date selected. |
|
JDateEditComponent(DateSelectionModel model)
|
|
| Method Summary | |
void |
addDateListener(DateListener listener)
Registers a date listener that will receive notifications when the date model changes. |
void |
commitEdit()
Makes the currently edited date to be the selected date but only if it is valid. |
protected void |
fireDateChanged(DateEvent evt)
|
protected void |
fireDateFieldChanged(DateEvent evt)
|
protected void |
fireDateFieldCleared(DateEvent evt)
|
int |
getAutoCenturyYear()
Detrmines the year used to build the long year when short years are used. |
java.lang.String |
getCustomDateFormat()
Returns the custom date format used to display and edit the dates. |
int |
getDateFormat()
Returns the format used to display the selected date. |
DateModel |
getDateModel()
Returns the date model used by this component. |
DateParser |
getDateParser()
Determines the date parser that converts free text entries into dates. |
java.lang.String |
getEmptySelectionText()
Returns the text displayed by this component when there is no date selected. |
java.lang.String |
getText()
|
protected void |
invalidEdit()
Invoked on an invalid date input. |
boolean |
isAutoCentury()
Determines whether century is automatically added to the year field if its value is less than 100. |
boolean |
isAutoRestore()
Determines whether an invalid date should be automatically restored to the last valid date. |
boolean |
isAutoValidate()
Determines whether the date edited by this component should be validated when focus is lost. |
boolean |
isBeepOnError()
Determines whether a beep will sound if the typed date is not valid, at validation time. |
boolean |
isEditValid()
Determines whether the current edited date is valid. |
boolean |
isFreeText()
Determines whether free text date entries are allowed. |
void |
removeDateListener(DateListener listener)
Removes a date listener registered on this component. |
void |
setAutoCentury(boolean enabled)
Specifies whether century is automatically added to the year field if its value is less than 100. |
void |
setAutoCenturyYear(int year)
Specifies the year used to build the long year when short years are used. |
void |
setAutoRestore(boolean enabled)
Specifies whether an invalid date should be automatically restored to the last valid date. |
void |
setAutoValidate(boolean enabled)
Specifies whether the temporary represented date is validated when the component loses focus. |
void |
setBeepOnError(boolean enabled)
Specifies whether a beep will sound if the typed date is not valid, at validation time. |
void |
setCustomDateFormat(java.lang.String pattern)
Specifies a custom date pattern that uses the Date Format Pattern Syntax to display and edit dates. |
void |
setDateFormat(int format)
Specifies how the date displayed by this component is formated. |
void |
setDateModel(DateModel model)
Specifies a new date model for this component. |
void |
setDateParser(DateParser parser)
Specifies the date parser that will be used to convert free text entries into dates. |
void |
setDateSelectionModel(DateSelectionModel model)
Specifies a new selection model for this component. |
void |
setEmptySelectionText(java.lang.String text)
Specifies the text displayed by this component when there is no date selected. |
void |
setFreeText(boolean enabled)
Specifies whether free text date entries are allowed. |
void |
setText(java.lang.String text)
|
| Methods inherited from class com.standbysoft.component.date.swing.JDateComponent |
addActionListener, addDateSelectionListener, fireActionEvent, fireDateSelectionChanged, fireDisabledDatesChanged, fireEmptySelectionAllowedChanged, fireSelectionModeChanged, getActionCommand, getDateSelectionModel, getLocale, getSelectedDate, getUI, isEmptySelectionAllowed, removeActionListener, removeDateSelectionListener, setActionCommand, setEmptySelectionAllowed, setLocale, setSelectedDate, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int dateFormat
protected java.lang.String customDateFormat
protected java.lang.String emptySelectionText
protected boolean autoRestore
protected boolean autoValidate
protected boolean beepOnError
protected DateModel dateModel
protected DateListener dateModelListener
protected DateParser dateParser
protected boolean freeText
protected java.lang.String text
| Constructor Detail |
public JDateEditComponent()
public JDateEditComponent(DateSelectionModel model)
| Method Detail |
public void setDateModel(DateModel model)
model - new date model to be used by this componentpublic DateModel getDateModel()
setDateModel(DateModel)public void addDateListener(DateListener listener)
listener - listener that is registeredsetDateModel(DateModel),
removeDateListener(DateListener)public void removeDateListener(DateListener listener)
listener - listener that is removedpublic void setAutoCentury(boolean enabled)
enabled - true if century is automatically added;
false otherwiseDateModel.setAutoCentury(boolean)public boolean isAutoCentury()
true if century is automatically added;
false otherwise.DateModel.isAutoCentury()public void setAutoCenturyYear(int year)
year - year used to build the long year when short years are usedDateModel.setAutoCenturyYear(int)public int getAutoCenturyYear()
DateModel.getAutoCenturyYear()public java.lang.String getEmptySelectionText()
setEmptySelectionText(String)public void setEmptySelectionText(java.lang.String text)
text - text displayed by this component when there is no date selectedpublic void setDateSelectionModel(DateSelectionModel model)
setDateSelectionModel in class JDateComponentmodel - new selection model to be used by this componentpublic int getDateFormat()
setDateFormat(int)public void setDateFormat(int format)
custom
date format that can also specify time fields.
format - format used to display the selected date. Valid values are
DateFormat.SHORT, DateFormat.MEDIUM,
DateFormat.LONG or DateFormat.FULL.setCustomDateFormat(String)public java.lang.String getCustomDateFormat()
null
if none is used.setCustomDateFormat(String)public void setCustomDateFormat(java.lang.String pattern)
current date format. For
instance if you want the date picker to format dates like "12:08 PM" you must use "h:mm a" as custom date pattern.
pattern - new date pattern that will be used to format dates for display or editing, or null if
you do not want to use a custom formatsetDateFormat(int)public void setText(java.lang.String text)
public java.lang.String getText()
public void setDateParser(DateParser parser)
parser - date parser that will be used to convert free text entries
into datessetFreeText(boolean)public DateParser getDateParser()
setDateParser(DateParser)public void setFreeText(boolean enabled)
enabled - true if free text is enabled; false
otherwisesetDateParser(DateParser)public boolean isFreeText()
true if free text date entries are allowed; false otherwise.setFreeText(boolean)public void setAutoValidate(boolean enabled)
enabled - true if validation should occur when focus is lost;
false otherwiseJDateComponent.getSelectedDate()public boolean isAutoValidate()
true if validation should occur when focus is lost;
false otherwise.setAutoValidate(boolean)public void setBeepOnError(boolean enabled)
enabled - true if the beep will sound on invalid entries;
false otherwiseinvalidEdit()public boolean isBeepOnError()
true if the beep will sound on invalid entries;
false otherwise.setBeepOnError(boolean)protected void invalidEdit()
setBeepOnError(boolean)public boolean isEditValid()
Determines whether the current edited date is valid. A valid date is a date that can be selected by the date selection model.
true if the date is accepted by the date selection
model; false otherwise.DateSelectionModel.isDateSelectable(Date)public void commitEdit()
isEditValid()public void setAutoRestore(boolean enabled)
enabled - true if at validation time, an invalid date should
be automatically restored to the last valid date; false otherwisesetAutoValidate(boolean)public boolean isAutoRestore()
true if at validation time, an invalid date should
be automatically restored to the last valid date; false otherwise.setAutoRestore(boolean)protected void fireDateFieldChanged(DateEvent evt)
protected void fireDateFieldCleared(DateEvent evt)
protected void fireDateChanged(DateEvent evt)
|
Java Date Picker v3.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Visit www.javadatepicker.com for further information or send us your suggestions.
Copyright © 2003-2004 Stand By Soft Ltd. All Rights Reserved.