Package org.jfree.ui

Class SerialDateChooserPanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class SerialDateChooserPanel extends JPanel implements ActionListener
A panel that allows the user to select a date.

This class is incomplete and untested. You should not use it yet...

See Also:
  • Field Details

    • DEFAULT_DATE_BUTTON_COLOR

      public static final Color DEFAULT_DATE_BUTTON_COLOR
      The default background color for the selected date.
    • DEFAULT_MONTH_BUTTON_COLOR

      public static final Color DEFAULT_MONTH_BUTTON_COLOR
      The default background color for the current month.
    • date

      private SerialDate date
      The date selected in the panel.
    • dateButtonColor

      private Color dateButtonColor
      The color for the selected date.
    • monthButtonColor

      private Color monthButtonColor
      The color for dates in the current month.
    • chosenOtherButtonColor

      private Color chosenOtherButtonColor
      The color for dates that are visible, but not in the current month.
    • firstDayOfWeek

      private int firstDayOfWeek
      The first day-of-the-week.
    • yearSelectionRange

      private int yearSelectionRange
      The range used for selecting years.
    • dateFont

      private Font dateFont
      The font used to display the date.
    • monthSelector

      private JComboBox monthSelector
      A combo for selecting the month.
    • yearSelector

      private JComboBox yearSelector
      A combo for selecting the year.
    • todayButton

      private JButton todayButton
      A button for selecting today's date.
    • buttons

      private JButton[] buttons
      An array of buttons used to display the days-of-the-month.
    • refreshing

      private boolean refreshing
      A flag that indicates whether or not we are currently refreshing the buttons.
  • Constructor Details

    • SerialDateChooserPanel

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

      public SerialDateChooserPanel(SerialDate date, boolean controlPanel)
      Constructs a new date chooser panel.
      Parameters:
      date - the date.
      controlPanel - a flag that indicates whether or not the 'today' button should appear on the panel.
    • SerialDateChooserPanel

      public SerialDateChooserPanel(SerialDate date, boolean controlPanel, Color dateButtonColor, Color monthButtonColor)
      Constructs a new date chooser panel.
      Parameters:
      date - the date.
      controlPanel - the control panel.
      dateButtonColor - the date button color.
      monthButtonColor - the month button color.
  • Method Details

    • setDate

      public void setDate(SerialDate date)
      Sets the date chosen in the panel.
      Parameters:
      date - the new date.
    • getDate

      public SerialDate getDate()
      Returns the date selected in the panel.
      Returns:
      the selected date.
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Handles action-events from the date panel.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - information about the event that occurred.
    • getCalendarPanel

      private JPanel getCalendarPanel()
      Returns a panel of buttons, each button representing a day in the month. This is a sub-component of the DatePanel.
      Returns:
      the panel.
    • getButtonColor

      protected Color getButtonColor(SerialDate targetDate)
      Returns the button color according to the specified date.
      Parameters:
      targetDate - the target date.
      Returns:
      the button color.
    • getFirstVisibleDate

      protected SerialDate getFirstVisibleDate()
      Returns the first date that is visible in the grid. This should always be in the month preceding the month of the selected date.
      Returns:
      the first visible date.
    • getFirstDayOfWeek

      private int getFirstDayOfWeek()
      Returns the first day of the week (controls the labels in the date panel).
      Returns:
      the first day of the week.
    • refreshButtons

      protected void refreshButtons()
      Update the button labels and colors to reflect date selection.
    • refreshYearSelector

      private void refreshYearSelector()
      Changes the contents of the year selection JComboBox to reflect the chosen date and the year range.
    • getYears

      private Vector getYears(int chosenYear)
      Returns a vector of years preceding and following the specified year. The number of years preceding and following is determined by the yearSelectionRange attribute.
      Parameters:
      chosenYear - the current year.
      Returns:
      a vector of years.
    • constructSelectionPanel

      private JPanel constructSelectionPanel()
      Constructs a panel containing two JComboBoxes (for the month and year) and a button (to reset the date to TODAY).
      Returns:
      the panel.
    • constructControlPanel

      private JPanel constructControlPanel()
      Returns a panel that appears at the bottom of the calendar panel - contains a button for selecting today's date.
      Returns:
      the panel.