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 Name | Property Type | Description |
Year | int |
Calendar year. |
Month | int |
Calendar month. |
Notes | String (Indexed) |
Notes for a day. |
MonthCal generates the following events:
Event Type | Event ID | Generated |
Description |
ObjActionEvent | ActionEvent.ACTION_PERFORMED |
Notes changed. |
ActionEvent.getActionCommand() is the new notes text, and
ObjActionEvent.getObject() is an Integer containing the day
number of the notes. |
-
eventMgr
- EventMgr object handles added event processing and dispatching.
-
MonthCal()
- Create a new MonthCal containing the current month.
-
MonthCal(int, int)
- Create a monthly calendar for year/month.
-
addActionListener(ActionListener)
- Add an action listener.
-
getMonth()
- Return the month of the calendar.
-
getNotes(int)
- Get the notes for the day.
-
getYear()
- Return the year of this calendar.
-
processActionEvent(ActionEvent)
- Process and dispatch action event.
-
processEvent(AWTEvent)
- Process and dispatch event.
-
removeActionListener(ActionListener)
- Remove an action listener.
-
setMonth(int)
- Set the month of the calendar.
-
setNotes(int, String)
- Attach the notes to the specified day.
-
setYear(int)
- Set the year of the calendar.
-
toString()
- Converts to a string representation.
eventMgr
protected EventMgr eventMgr
- EventMgr object handles added event processing and dispatching.
MonthCal
public MonthCal()
- Create a new MonthCal containing the current month.
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.
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.
getYear
public int getYear()
- Return the year of this calendar.
- Returns:
- calendar year.
setMonth
public synchronized void setMonth(int month)
- Set the month of the calendar. This causes a repaint.
- Parameters:
- month - calendar month, starts from 0.
getMonth
public int getMonth()
- Return the month of the calendar.
- Returns:
- calendar month, starts from 0.
toString
public String toString()
- Converts to a string representation.
- Returns:
- string representation.
- Overrides:
- toString in class Component
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.
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.
addActionListener
public void addActionListener(ActionListener listener)
- Add an action listener.
- Parameters:
- listener - action listener.
removeActionListener
public void removeActionListener(ActionListener listener)
- Remove an action listener.
- Parameters:
- listener - action listener.
processEvent
public void processEvent(AWTEvent e)
- Process and dispatch event.
- Parameters:
- e - event object.
- Overrides:
- processEvent in class Grid
processActionEvent
public void processActionEvent(ActionEvent e)
- Process and dispatch action event.
- Parameters:
- e - action event.
All Packages Class Hierarchy This Package Previous Next Index