All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ca.bc.europa.awt.MonthCal

java.lang.Object
   |
   +----java.awt.Component
           |
           +----ca.bc.europa.awt.MonthCal

public class MonthCal
extends Component
implements Runnable, ItemSelectable

The MonthCal class displays a Calendar.

The look of the calendar is taken from an image, which is chopped up into 1-31 day images, and recombined to represent the chosen month (like a shuffle puzzel).
The component starts a thread to prepare the calendar so that the calling code will not have to wait around for initialization.

Example Calendar Image:

See Also:
Component, Runable, GregorianCalendar, Calendar

Constructor Index

 o MonthCal(Image, int, int, int, int, int)
MonthCal(calImage, cellWidth, cellHeight, titleHeight, year, month)
 o MonthCal(Image, int, int, int, int, int, ImageFilter, ImageFilter)
MonthCal(calImage, cellWidth, cellHeight, titleHeight, year, month)
 o MonthCal(URL, int, int, int, int, int)
MonthCal(imageURL, cellWidth, cellHeight, titleHeight, year, month)
 o MonthCal(URL, int, int, int, int, int, ImageFilter, ImageFilter)
MonthCal(imageURL, cellWidth, cellHeight, titleHeight, year, month)

Method Index

 o addItemListener(ItemListener)
Add a listener for ItemEvent.
 o clear()
Clear all selected dates.
 o getGregorianCalendar()
Get the Gregorian calendar associated with the displayed calendar.
 o getLastDayOfMonth(GregorianCalendar)
Get the last day of the current month.
 o getPreferredSize()
 o getSelectedDays()
Get an array representing the selection states of the days.
 o getSelectedObjects()
Return the selected date as an Object array.
 o mouseCallBack(MouseEvent)
 o paint(Graphics)
 o removeItemListener(ItemListener)
Remove a listener for ItemEvent.
 o run()
Load the image that defines the calendar and generate all visuals.
 o set(int, int)
Set the year and month of the calendar, the month is in classic GregorianCalendar format of 0 to 11.
 o setDay(int, boolean)
Set the selection state of a day.
 o setMultiSelect(boolean)
Set the multi selection behaviour.
 o update(Graphics)

Constructors

 o MonthCal
 public MonthCal(Image calImage,
                 int width,
                 int height,
                 int tHeight,
                 int year,
                 int month,
                 ImageFilter def,
                 ImageFilter sel)
MonthCal(calImage, cellWidth, cellHeight, titleHeight, year, month)

Parameters:
calImage - An image of a calendar, title on top, day boxes begin upper left and progress right, wrap every 7 days.
cellWidth - The pixel width of a single day on the image.
cellHeight - The pixel height of a single day on the image.
titleHeight - The pixel height of the calendar title bar.
year - The year of the calendar.
month - The month of the calendar (0-11).
def - The ImageFilter used to construct default day images.
sel - The ImageFilter used to construct images for selected. days.
 o MonthCal
 public MonthCal(Image calImage,
                 int width,
                 int height,
                 int tHeight,
                 int year,
                 int month)
MonthCal(calImage, cellWidth, cellHeight, titleHeight, year, month)

Parameters:
calImage - An image of a calendar, title on top, day boxes begin upper left and progress right, wrap every 7 days.
cellWidth - The pixel width of a single day on the image.
cellHeight - The pixel height of a single day on the image.
titleHeight - The pixel height of the calendar title bar.
year - The year of the calendar.
month - The month of the calendar (0-11).
 o MonthCal
 public MonthCal(URL imageURL,
                 int width,
                 int height,
                 int tHeight,
                 int year,
                 int month,
                 ImageFilter def,
                 ImageFilter sel)
MonthCal(imageURL, cellWidth, cellHeight, titleHeight, year, month)

Parameters:
imageURL - A URL to an image of a calendar, title on top, day boxes begin upper left and progress right, wrap every 7 days.
cellWidth - The pixel width of a single day on the image.
cellHeight - The pixel height of a single day on the image.
titleHeight - The pixel height of the calendar title bar.
year - The year of the calendar.
month - The month of the calendar (0-11).
def - The ImageFilter used to construct default day images.
sel - The ImageFilter used to construct images for selected. days.
 o MonthCal
 public MonthCal(URL imageURL,
                 int width,
                 int height,
                 int tHeight,
                 int year,
                 int month)
MonthCal(imageURL, cellWidth, cellHeight, titleHeight, year, month)

Parameters:
imageURL - A URL to an image of a calendar, title on top, day boxes begin upper left and progress right, wrap every 7 days.
cellWidth - The pixel width of a single day on the image.
cellHeight - The pixel height of a single day on the image.
titleHeight - The pixel height of the calendar title bar.
year - The year of the calendar.
month - The month of the calendar (0-11).

Methods

 o getPreferredSize
 public Dimension getPreferredSize()
Overrides:
getPreferredSize in class Component
 o update
 public void update(Graphics g)
Overrides:
update in class Component
 o paint
 public void paint(Graphics g)
Overrides:
paint in class Component
 o run
 public void run()
Load the image that defines the calendar and generate all visuals.

 o set
 public void set(int year,
                 int month)
Set the year and month of the calendar, the month is in classic GregorianCalendar format of 0 to 11.

Parameters:
year - The year in YYYY format.
month - The month 0 to 11, i.e. January == 0.
 o getGregorianCalendar
 public GregorianCalendar getGregorianCalendar()
Get the Gregorian calendar associated with the displayed calendar.

 o getSelectedDays
 public boolean[] getSelectedDays()
Get an array representing the selection states of the days.

 o setMultiSelect
 public void setMultiSelect(boolean state)
Set the multi selection behaviour. true state allows multiple days to be selected at one time.

 o setDay
 public void setDay(int day,
                    boolean toggle)
Set the selection state of a day.

Parameters:
day - The day to be selected or deselected, from 0 to 30.
toggle - The selection state.
 o getLastDayOfMonth
 public int getLastDayOfMonth(GregorianCalendar g)
Get the last day of the current month.

Parameters:
g - A GregorianCalendar that is set to the month you are interested in.
 o getSelectedObjects
 public Object[] getSelectedObjects()
Return the selected date as an Object array.

See Also:
ItemSelectable
 o addItemListener
 public void addItemListener(ItemListener l)
Add a listener for ItemEvent.

See Also:
ItemSelectable
 o removeItemListener
 public void removeItemListener(ItemListener l)
Remove a listener for ItemEvent.

See Also:
ItemSelectable
 o clear
 public void clear()
Clear all selected dates. no repaint is done

 o mouseCallBack
 public void mouseCallBack(MouseEvent e)

All Packages  Class Hierarchy  This Package  Previous  Next  Index