All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.set.MonthCal

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----tea.set.Grid
                                   |
                                   +----tea.set.MonthCal

public class MonthCal
extends Grid
MonthCal widget provides an interface to manipulate one month calendar. The interface of MonthCal resembles a monthly organizor. The days are layed out in a grid. Each day can have a notes attached to it. Users can enter a notes to a day by double click inside the day cell. Since MonthCal is inherited from Grid, all Grid method can be used to manipulate the behavior and apparence MonthCal.

When the notes inside a day changes, an action event is generated, with ObjActionEvent.getObject() point to an Integer object with its value equals to the day where the notes changed.

MonthCal supports the following properties:
Property NameProperty TypeDescription
Yearint Calendar year.
Monthint Calendar month.
NotesString (Indexed) Notes for a day.

MonthCal generates the following events:
Event TypeEvent IDGenerated Description
ObjActionEventActionEvent.ACTION_PERFORMED Notes changed. ActionEvent.getActionCommand() is the new notes text, and ObjActionEvent.getObject() is an Integer containing the day number of the notes.


Variable Index

 o eventMgr
EventMgr object handles added event processing and dispatching.

Constructor Index

 o MonthCal()
Create a new MonthCal containing the current month.
 o MonthCal(int, int)
Create a monthly calendar for year/month.

Method Index

 o addActionListener(ActionListener)
Add an action listener.
 o getMonth()
Return the month of the calendar.
 o getNotes(int)
Get the notes for the day.
 o getYear()
Return the year of this calendar.
 o processActionEvent(ActionEvent)
Process and dispatch action event.
 o processEvent(AWTEvent)
Process and dispatch event.
 o removeActionListener(ActionListener)
Remove an action listener.
 o setMonth(int)
Set the month of the calendar.
 o setNotes(int, String)
Attach the notes to the specified day.
 o setYear(int)
Set the year of the calendar.
 o toString()
Converts to a string representation.

Variables

 o eventMgr
 protected EventMgr eventMgr
EventMgr object handles added event processing and dispatching.

Constructors

 o MonthCal
 public MonthCal()
Create a new MonthCal containing the current month.

 o MonthCal
 public MonthCal(int year,
                 int month)
Create a monthly calendar for year/month. Year starts from 1900, so pass 96 for 1996. Month starts from 0 to 11, corresponding to Jan to Dec respectively.

Parameters:
year - calendar year, year number minus 1900.
month - calendar month, starts from 0.

Methods

 o setYear
 public synchronized void setYear(int year)
Set the year of the calendar. This causes a repaint.

Parameters:
year - calendar year, year number minus 1900.
 o getYear
 public int getYear()
Return the year of this calendar.

Returns:
calendar year.
 o setMonth
 public synchronized void setMonth(int month)
Set the month of the calendar. This causes a repaint.

Parameters:
month - calendar month, starts from 0.
 o getMonth
 public int getMonth()
Return the month of the calendar.

Returns:
calendar month, starts from 0.
 o toString
 public String toString()
Converts to a string representation.

Returns:
string representation.
Overrides:
toString in class Component
 o getNotes
 public String getNotes(int day)
Get the notes for the day. If no notes is attached to the day, null is returned instead. Day number starts at 1.

Parameters:
day - day number.
Returns:
text notes for the day.
 o setNotes
 public synchronized void setNotes(int day,
                                   String notes)
Attach the notes to the specified day. Day number starts at 1.

Parameters:
day - day number.
notes - text notes for the day.
 o addActionListener
 public void addActionListener(ActionListener listener)
Add an action listener.

Parameters:
listener - action listener.
 o removeActionListener
 public void removeActionListener(ActionListener listener)
Remove an action listener.

Parameters:
listener - action listener.
 o processEvent
 public void processEvent(AWTEvent e)
Process and dispatch event.

Parameters:
e - event object.
Overrides:
processEvent in class Grid
 o processActionEvent
 public void processActionEvent(ActionEvent e)
Process and dispatch action event.

Parameters:
e - action event.

All Packages  Class Hierarchy  This Package  Previous  Next  Index