|
||||||||||
| 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
javax.swing.text.JTextComponent
javax.swing.JTextField
javax.swing.JFormattedTextField
edu.wisc.ssec.mcidasv.data.dateChooser.JTextFieldDateEditor
public class JTextFieldDateEditor
JTextFieldDateEditor is the default editor used by JDateChooser. It is a formatted text field, that colores valid dates green/black and invalid dates red. The date format patten and mask can be set manually. If not set, the MEDIUM pattern of a SimpleDateFormat with regards to the actual locale is used.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JFormattedTextField |
|---|
JFormattedTextField.AbstractFormatter, JFormattedTextField.AbstractFormatterFactory |
| Nested classes/interfaces inherited from class javax.swing.JTextField |
|---|
JTextField.AccessibleJTextField |
| Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
|---|
JTextComponent.AccessibleJTextComponent, JTextComponent.DropLocation, JTextComponent.KeyBinding |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private Calendar |
calendar
|
protected Color |
darkGreen
|
protected Date |
date
|
protected SimpleDateFormat |
dateFormatter
|
protected String |
datePattern
|
protected DateUtil |
dateUtil
|
private int |
hours
|
private boolean |
ignoreDatePatternChange
|
private boolean |
isMaskVisible
|
protected MaskFormatter |
maskFormatter
|
protected String |
maskPattern
|
private int |
millis
|
private int |
minutes
|
protected char |
placeholder
|
private int |
seconds
|
private static long |
serialVersionUID
|
| Fields inherited from class javax.swing.JFormattedTextField |
|---|
COMMIT, COMMIT_OR_REVERT, PERSIST, REVERT |
| Fields inherited from class javax.swing.JTextField |
|---|
notifyAction |
| Fields inherited from class javax.swing.text.JTextComponent |
|---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| 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 javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JTextFieldDateEditor()
|
|
JTextFieldDateEditor(boolean showMask,
String datePattern,
String maskPattern,
char placeholder)
|
|
JTextFieldDateEditor(String datePattern,
String maskPattern,
char placeholder)
|
|
| Method Summary | |
|---|---|
void |
actionPerformed(ActionEvent e)
Validates the typed date and sets it (only if it is valid). |
void |
caretUpdate(CaretEvent event)
After any user input, the value of the textfield is proofed. |
private void |
checkText()
|
String |
createMaskFromDatePattern(String datePattern)
Creates a mask from a date pattern. |
void |
focusGained(FocusEvent e)
|
void |
focusLost(FocusEvent focusEvent)
|
Date |
getDate()
Returns the date. |
String |
getDateFormatString()
Returns tha date format string. |
Date |
getMaxSelectableDate()
Gets the minimum selectable date. |
Date |
getMinSelectableDate()
Gets the maximum selectable date. |
Dimension |
getPreferredSize()
Returns the preferred size. |
JComponent |
getUiComponent()
Returns the UI component, e.g. the actual JTextField implementing the editor. |
boolean |
isMaskVisible()
Returns true, if the mask is visible. |
static void |
main(String[] s)
Creates a JFrame with a JCalendar inside and can be used for testing. |
void |
setDate(Date date)
Sets the date. |
protected void |
setDate(Date date,
boolean firePropertyChange)
Sets the date. |
void |
setDateFormatString(String dateFormatString)
Sets the date format string, e.g. |
void |
setEnabled(boolean b)
Enables and disabled the compoment. |
void |
setLocale(Locale locale)
Sets the locale. |
void |
setMaskVisible(boolean isMaskVisible)
Sets the mask visible. |
void |
setMaxSelectableDate(Date max)
Sets the maximum selectable date. |
void |
setMinSelectableDate(Date min)
Sets the minimum selectable date. |
void |
setSelectableDateRange(Date min,
Date max)
Sets a valid date range for selectable dates. |
| Methods inherited from class javax.swing.JFormattedTextField |
|---|
commitEdit, getActions, getFocusLostBehavior, getFormatter, getFormatterFactory, getUIClassID, getValue, invalidEdit, isEditValid, processFocusEvent, processInputMethodEvent, setDocument, setFocusLostBehavior, setFormatter, setFormatterFactory, setValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.wisc.ssec.mcidasv.data.dateChooser.IDateEditor |
|---|
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
| Field Detail |
|---|
private static final long serialVersionUID
protected Date date
protected SimpleDateFormat dateFormatter
protected MaskFormatter maskFormatter
protected String datePattern
protected String maskPattern
protected char placeholder
protected Color darkGreen
protected DateUtil dateUtil
private boolean isMaskVisible
private boolean ignoreDatePatternChange
private int hours
private int minutes
private int seconds
private int millis
private Calendar calendar
| Constructor Detail |
|---|
public JTextFieldDateEditor()
public JTextFieldDateEditor(String datePattern,
String maskPattern,
char placeholder)
public JTextFieldDateEditor(boolean showMask,
String datePattern,
String maskPattern,
char placeholder)
| Method Detail |
|---|
public Date getDate()
IDateEditor
getDate in interface IDateEditorpublic void setDate(Date date)
IDateEditor
setDate in interface IDateEditordate - the date to set
protected void setDate(Date date,
boolean firePropertyChange)
date - the datefirePropertyChange - true, if the date property should be fired.public void setDateFormatString(String dateFormatString)
IDateEditor
setDateFormatString in interface IDateEditordateFormatString - the date format stringpublic String getDateFormatString()
IDateEditor
getDateFormatString in interface IDateEditorpublic JComponent getUiComponent()
IDateEditor
getUiComponent in interface IDateEditorpublic void caretUpdate(CaretEvent event)
caretUpdate in interface CaretListenerevent - the caret eventpublic void focusLost(FocusEvent focusEvent)
focusLost in interface FocusListenerprivate void checkText()
public void focusGained(FocusEvent e)
focusGained in interface FocusListenerpublic void setLocale(Locale locale)
IDateEditor
setLocale in interface IDateEditorsetLocale in class Componentlocale - the locale to setpublic String createMaskFromDatePattern(String datePattern)
datePattern - the date pattern
public boolean isMaskVisible()
public void setMaskVisible(boolean isMaskVisible)
isMaskVisible - true, if the mask should be visiblepublic Dimension getPreferredSize()
getPreferredSize in class JTextFieldpublic void actionPerformed(ActionEvent e)
actionPerformed in interface ActionListenerpublic void setEnabled(boolean b)
setEnabled in interface IDateEditorsetEnabled in class JComponentb - true, if the UI component should be enabled.public Date getMaxSelectableDate()
IDateEditor
getMaxSelectableDate in interface IDateEditorpublic Date getMinSelectableDate()
IDateEditor
getMinSelectableDate in interface IDateEditorpublic void setMaxSelectableDate(Date max)
IDateEditor
setMaxSelectableDate in interface IDateEditormax - maximum selectable datepublic void setMinSelectableDate(Date min)
IDateEditor
setMinSelectableDate in interface IDateEditormin - minimum selectable date
public void setSelectableDateRange(Date min,
Date max)
IDateEditor
setSelectableDateRange in interface IDateEditormin - the minimum selectable date or null (then the minimum date should be
set to 01\01\0001)max - the maximum selectable date or null (then the maximum date should be
set to 01\01\9999)public static void main(String[] s)
s - The command line arguments
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||