Class MiniCal

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

public class MiniCal extends JPanel implements MouseListener
Displays a standard Julian Calendar. The selected day of the month can be changed by clicking on a number in the display.
Author:
Kapono Carter
See Also:
  • Field Details

  • Constructor Details

    • MiniCal

      public MiniCal()
      Creates a standard Julian calendar displaying today's year and month
    • MiniCal

      public MiniCal(int month)
      Creates a standard Julian calendar displaying today's year and the given month
      Parameters:
      month - The desired month
    • MiniCal

      public MiniCal(int year, int month)
      Creates a standard Julian calendar displaying the given year and month
      Parameters:
      year - The desired year
      month - The desired month
  • Method Details

    • getSelectedDate

      public Date getSelectedDate()
      Retrieves the date selected by the user. If the user has not changed the date, return the date set programmatically through the constructor or through the setDate() method.
      Returns:
      the selected date
    • setSelectedDate

      public void setSelectedDate(Date d)
      Establish the user selected date.
    • getDate

      public Date getDate()
      Retrieves the date currently displayed by this calendar
      Returns:
      the date displayed by this calendar
    • setDate

      public void setDate(Date d)
      Set the date displayed by this calandar
      Parameters:
      d - the new Date
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • updateView

      public void updateView(int year, int month)
      Reconfigure the UI layout to match the given year, month. This method simply re-arranges the existing gui-objects instead of creating new ones.
      Parameters:
      year - the new year
      month - the new month
    • setTodayColor

      public void setTodayColor(Color c)
      Change the color representing "today". By default, Today color is the current foreground color.
      Parameters:
      c - the new today color
    • getTodayColor

      public Color getTodayColor()
      Retrieves the color representing "today"
      Returns:
      the color representing "today"
    • setSelectedDateColor

      public void setSelectedDateColor(Color c)
      Change the color representing the user selected date. By default, the select color used is equivalent to the selected text background color.
      Parameters:
      c - the new current date color
    • getSelectedDateColor

      public Color getSelectedDateColor()
      Retrieves the color representing the user selected date
      Returns:
      the color representing the user selected date
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener l)
      Establish a listener for property change events from this component
      Overrides:
      addPropertyChangeListener in class Container
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener l)
      Remove a listener for property change events from this component
      Overrides:
      removePropertyChangeListener in class Component
    • setChanger

      public void setChanger(DateChanger ch)
      Specifies the component that contains the month/year changing controls. This component may be specified only once; subsequent calls to this method will be ignored.
    • main

      public static void main(String[] args)