org.jfree.ui

Class DateChooserPanel

public class DateChooserPanel extends JPanel implements ActionListener

A panel that allows the user to select a date.

Author: David Gilbert

Constructor Summary
DateChooserPanel()
Constructs a new date chooser panel, using today's date as the initial selection.
DateChooserPanel(Calendar calendar, boolean controlPanel)
Constructs a new date chooser panel.
Method Summary
voidactionPerformed(ActionEvent e)
Handles action-events from the date panel.
ColorgetChosenDateButtonColor()
Returns the color for the currently selected date.
ColorgetChosenMonthButtonColor()
Returns the color for the buttons representing the current month.
ColorgetChosenOtherButtonColor()
Returns the color for the buttons representing the other months.
DategetDate()
Returns the date selected in the panel.
intgetYearSelectionRange()
Returns the range of years available for selection (defaults to 20).
voidsetChosenDateButtonColor(Color chosenDateButtonColor)
Redefines the color for the currently selected date.
voidsetChosenMonthButtonColor(Color chosenMonthButtonColor)
Defines the color for the buttons representing the current month.
voidsetChosenOtherButtonColor(Color chosenOtherButtonColor)
Redefines the color for the buttons representing the other months.
voidsetDate(Date theDate)
Sets the date chosen in the panel.
voidsetYearSelectionRange(int yearSelectionRange)
Sets the range of years available for selection.

Constructor Detail

DateChooserPanel

public DateChooserPanel()
Constructs a new date chooser panel, using today's date as the initial selection.

DateChooserPanel

public DateChooserPanel(Calendar calendar, boolean controlPanel)
Constructs a new date chooser panel.

Parameters: calendar the calendar controlling the date. controlPanel a flag that indicates whether or not the 'today' button should appear on the panel.

Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)
Handles action-events from the date panel.

Parameters: e information about the event that occurred.

getChosenDateButtonColor

public Color getChosenDateButtonColor()
Returns the color for the currently selected date.

Returns: a color.

getChosenMonthButtonColor

public Color getChosenMonthButtonColor()
Returns the color for the buttons representing the current month.

Returns: the color for the current month.

getChosenOtherButtonColor

public Color getChosenOtherButtonColor()
Returns the color for the buttons representing the other months.

Returns: a color.

getDate

public Date getDate()
Returns the date selected in the panel.

Returns: the selected date.

getYearSelectionRange

public int getYearSelectionRange()
Returns the range of years available for selection (defaults to 20).

Returns: The range.

setChosenDateButtonColor

public void setChosenDateButtonColor(Color chosenDateButtonColor)
Redefines the color for the currently selected date.

Parameters: chosenDateButtonColor the new color

setChosenMonthButtonColor

public void setChosenMonthButtonColor(Color chosenMonthButtonColor)
Defines the color for the buttons representing the current month.

Parameters: chosenMonthButtonColor the color for the current month.

setChosenOtherButtonColor

public void setChosenOtherButtonColor(Color chosenOtherButtonColor)
Redefines the color for the buttons representing the other months.

Parameters: chosenOtherButtonColor a color.

setDate

public void setDate(Date theDate)
Sets the date chosen in the panel.

Parameters: theDate the new date.

setYearSelectionRange

public void setYearSelectionRange(int yearSelectionRange)
Sets the range of years available for selection.

Parameters: yearSelectionRange the range.