com.toedter.calendar
Class JDateChooser
JPanel
com.toedter.calendar.JDateChooser
- ActionListener, ChangeListener, PropertyChangeListener
public class JDateChooser
extends JPanel
implements ActionListener, PropertyChangeListener, ChangeListener
A date chooser containig a date spinner and a button, that makes a JCalendar visible for
choosing a date.
JDateChooser() - Creates a new JDateChooser object.
|
JDateChooser(ImageIcon icon) - Creates a new JDateChooser object.
|
JDateChooser(String dateFormatString, boolean startEmpty) - Creates a new JDateChooser object with given date format string.
|
JDateChooser(boolean startEmpty) - Creates a new JDateChooser object.
|
JDateChooser(JCalendar jcalendar) - Creates a new JDateChooser object from a given JCalendar.
|
JDateChooser(JCalendar jcalendar, String dateFormatString, boolean startEmpty, ImageIcon icon) - Creates a new JDateChooser.
|
void | actionPerformed(ActionEvent e) - Called when the jalendar button was pressed.
|
Date | getDate() - Returns the date.
|
String | getDateFormatString() - Gets the date format string.
|
SpinnerDateModel | getModel() - Return the SpinnerDateModel associated with this control.
|
String | getName() - Returns "JDateChooser".
|
JSpinner | getSpinner() - Return this controls JSpinner control.
|
void | propertyChange(PropertyChangeEvent evt) - Listens for a "date" property change or a "day" property change event from the JCalendar.
|
void | setDate(Date date) - Sets the date.
|
void | setDateFormatString(String dateFormatString) - Sets the date format string.
|
void | setLocale(Locale l) - Sets the locale.
|
void | setModel(SpinnerDateModel mdl) - Set the SpinnerDateModel for this control.
|
void | stateChanged(ChangeEvent e) - Fires property "date" changes, recting on the spinner's state changes.
|
void | updateUI() - Updates the UI of itself and the popup.
|
calendarButton
protected JButton calendarButton
dateFormatString
protected String dateFormatString
dateSelected
protected boolean dateSelected
dateSpinner
protected JSpinner dateSpinner
editor
protected JSpinner.DateEditor editor
isInitialized
protected boolean isInitialized
lastSelectedDate
protected Date lastSelectedDate
model
protected SpinnerDateModel model
popup
protected JPopupMenu popup
startEmpty
protected boolean startEmpty
JDateChooser
public JDateChooser()
Creates a new JDateChooser object.
JDateChooser
public JDateChooser(ImageIcon icon)
Creates a new JDateChooser object.
JDateChooser
public JDateChooser(String dateFormatString,
boolean startEmpty)
Creates a new JDateChooser object with given date format string. The default date format
string is "MMMMM d, yyyy".
dateFormatString
- the date format stringstartEmpty
- true, if the date field should be empty
JDateChooser
public JDateChooser(boolean startEmpty)
Creates a new JDateChooser object.
startEmpty
- true, if the date field should be empty
JDateChooser
public JDateChooser(JCalendar jcalendar)
Creates a new JDateChooser object from a given JCalendar.
jcalendar
- the JCalendar
JDateChooser
public JDateChooser(JCalendar jcalendar,
String dateFormatString,
boolean startEmpty,
ImageIcon icon)
Creates a new JDateChooser.
jcalendar
- the jcalendar or nulldateFormatString
- the date format string or null (then "MMMMM d, yyyy" is used)startEmpty
- true, if the date field should be emptyicon
- the icon or null (then an internal icon is used)
actionPerformed
public void actionPerformed(ActionEvent e)
Called when the jalendar button was pressed.
getDate
public Date getDate()
Returns the date.
getDateFormatString
public String getDateFormatString()
Gets the date format string.
- Returns the dateFormatString.
getModel
public SpinnerDateModel getModel()
Return the SpinnerDateModel associated with this control.
getName
public String getName()
Returns "JDateChooser".
getSpinner
public JSpinner getSpinner()
Return this controls JSpinner control.
propertyChange
public void propertyChange(PropertyChangeEvent evt)
Listens for a "date" property change or a "day" property change event from the JCalendar.
Updates the dateSpinner and closes the popup.
setDate
public void setDate(Date date)
Sets the date. Fires the property change "date".
setDateFormatString
public void setDateFormatString(String dateFormatString)
Sets the date format string. E.g "MMMMM d, yyyy" will result in "July 21, 2004" if this is
the selected date and locale is English.
dateFormatString
- The dateFormatString to set.
setLocale
public void setLocale(Locale l)
Sets the locale.
setModel
public void setModel(SpinnerDateModel mdl)
Set the SpinnerDateModel for this control. This method allows the JDateChooser
control to be used with some persistence frameworks (ie. Oracle ADF) to bind the
control to the database Date value.
mdl
- the SpinnerDateModel
stateChanged
public void stateChanged(ChangeEvent e)
Fires property "date" changes, recting on the spinner's state changes.
updateUI
public void updateUI()
Updates the UI of itself and the popup.
Copyright B) 1999 - 2004 Kai Toedter.