All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class net.e2technologies.util.ECalendar

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----javax.swing.JComponent
                           |
                           +----javax.swing.JPanel
                                   |
                                   +----net.e2technologies.util.ECalendar

public class ECalendar
extends JPanel
implements Serializable, ActionListener
ECalendar is a versital class that can be used for selecting a calendar day. This class is very flexible in its use. The font, grid, and all colors are easily changed via the API. ECalendar takes on characteristics of a common component (i.e. ActionEvents can be captured, data can be retrieved and set). The year and month spinners are based on the ENumericSpinner and ETextSpinner. This component is build of all Swing components, and therefore can leverage all the Swing features, such as changing Look & Feel.


Constructor Index

 o ECalendar(Date, ECalendarListener)
Constructor for ECalendar.
 o ECalendar(Date, ECalendarListener, boolean)
Constructor for ECalendar.
 o ECalendar(Date, ECalendarListener, boolean, boolean, Color, Color, Color, Color, Color, Color, Color, Color, Color, Color, Color, Font)
Constructor for ECalendar.
 o ECalendar(Date, ECalendarListener, boolean, Color, Color)
Constructor for ECalendar.
 o ECalendar(ECalendarListener)
Default Constructor for ECalendar.
 o ECalendar(ECalendarListener, boolean)
Constructor for ECalendar.

Method Index

 o actionPerformed(ActionEvent)
notifies the calendar when some action has been performed that is should be aware of.
 o addActionListener(ActionListener)
adds a ActionListener to the calendar's list of action listners to be notified when the calendar fires an ActionEvent.
 o getCalendar()
gets the calendars' current date in the form of java.util.Calenar.
 o getDate()
gets the current date selected within the calendar
 o getDay()
gets the day of the month currently selected
 o getMonth()
gets the month currently selected within the calendar.
 o getYear()
gets the value of the year currently selected
 o setActiveBackground(Color)
sets the Active Cells' background color.
 o setActiveForeground(Color)
sets the Active Cell's foreground color.
 o setBlankBackground(Color)
sets the Blank Days Cells' background color.
 o setBlankForeground(Color)
sets the Blank Days Cells' foreground color.
 o setBlankGridColor(Color)
sets the grid color for the Blank Cells.
 o setCalendar(Calendar)
will set the internal month, day, and year of the calendar and then update the calendar visually.
 o setCalendarFont(Font)
sets the Font to be used within the foreground of all the cells.
 o setDate(Date)
will set the internal month, day and year of the calendar and then update the calendar visually.
 o setDateAndExit(int)
This is called when the user selects a new date.
 o setDay(int)
sets the day of the current month within the calendar
 o setDayBackground(Color)
sets the Day Cells' background
 o setDayForeground(Color)
sets the Day Cells' foreground
 o setDayGridColor(Color)
sets the grid color for the Day Cells.
 o setMonth(int)
sets the month within the calendar.
 o setShowGrid(boolean)
turns on/off the grid within the calendar.
 o setShowOpaque(boolean)
turs on/off the background colors in the cells of the calendar.
 o setWeekDayBackground(Color)
sets the Week Day Cells' background.
 o setWeekDayForeground(Color)
sets the Week Day Cells' foreground
 o setWeekDayGridColor(Color)
sets the grid color for the Week Day Cells.
 o setYear(int)
sets the year within the calendar

Constructors

 o ECalendar
 public ECalendar(ECalendarListener p_listener)
Default Constructor for ECalendar. This will build a ECalendar will all the default options. By default, the grid will not be displayed, the grid will not be opaque, and the default Font is TimesNewRoman. The current date will be displayed by default.

Parameters:
ECalendarListener - p_listener - this is required so that the listener can be notified when a new day is selected.
 o ECalendar
 public ECalendar(ECalendarListener p_listener,
                  boolean p_showGrid)
Constructor for ECalendar.

Parameters:
ECalendarListener - p_listener - this is required so that the listener can be notified when a new day is selected. The current date will be displayed by default.
boolean - p_showGrid - true will show the grid in the calendar, false will not.
 o ECalendar
 public ECalendar(Date p_date,
                  ECalendarListener p_listener)
Constructor for ECalendar.

Parameters:
Date - p_date - the initial date to display within the calendar.
ECalendarListener - p_listener - this is required so that the listener can be notified when a new day is selected.
 o ECalendar
 public ECalendar(Date p_date,
                  ECalendarListener p_listener,
                  boolean p_showGrid)
Constructor for ECalendar.

Parameters:
Date - p_date - the initial date to display within the calendar.
ECalendarListener - p_listener - this is required so that the listener can be notified when a new day is selected.
boolean - p_showGrid - true will show the grid in the calendar, false will not.
 o ECalendar
 public ECalendar(Date p_date,
                  ECalendarListener p_listener,
                  boolean p_showGrid,
                  Color p_weekDayColor,
                  Color p_dayColor)
Constructor for ECalendar.

Parameters:
Date - p_date - the initial date to display within the calendar.
ECalendarListener - - this is required so that the listener can be notified when a new day is selected.
boolean - p_showGrid - true will show the grid in the calendar, false will not.
Color - p_weekDayColor - the color of the foreground text for the week days.
Color - p_dayColor - the color of the foreground number for the days.
 o ECalendar
 public ECalendar(Date p_date,
                  ECalendarListener p_listener,
                  boolean p_showGrid,
                  boolean p_isOpaque,
                  Color p_weekDayForeground,
                  Color p_weekDayBackground,
                  Color p_dayForeground,
                  Color p_dayBackground,
                  Color p_activeForeground,
                  Color p_activeBackground,
                  Color p_blankForeground,
                  Color p_blankBackground,
                  Color p_weekDayGridColor,
                  Color p_dayGridColor,
                  Color p_blankGridColor,
                  Font p_font)
Constructor for ECalendar. This contains the most options at contruction.

Parameters:
Date - p_date - the initial date to display within the calendar.
ECalendarListener - - this is required so that the listener can be notified when a new day is selected.
boolean - p_showGrid - true will show the grid in the calendar, false will not.
boolean - p_isOpaque - true will not show the grid background colors, false will.
Color - p_weekDayForeground - the color for the Week Day cells' foreground text.
Color - p_weekDayBackground - the color for the Week Day cells' background.
Color - p_dayForeground - the color for the Day cells' foreground number.
Color - p_dayBackground - the color for the Day cells' background.
Color - p_activeForeground - the color for the selected (active) cell's foreground.
Color - p_activeBackground - the color for the selected (active) cell's background.
Color - p_blankForeground - the color for the blank day cells' foreground (this will not be shown unless the code for this class is altered since nothing is shown in the foreground by default).
Color - p_blankBackground - the color for the blank day cells' background.
Color - p_weekDayGridColor - the color of the grid surrounding the week days.
Color - p_dayGridColor - the color of the grid surrounding the days.
Color - p_blankGirdColor - the color of the grid surrounding the blank days.
Font - p_font - the font to use for the week day text and the day numbers.

Methods

 o getDate
 public Date getDate()
gets the current date selected within the calendar

Returns:
Date - the current date stored within the calendar
 o setDate
 public void setDate(Date p_newDate)
will set the internal month, day and year of the calendar and then update the calendar visually.

Parameters:
Date - p_newDate - the new Date to set the calendar to
 o setCalendar
 public void setCalendar(Calendar p_newCalendar)
will set the internal month, day, and year of the calendar and then update the calendar visually.

Parameters:
Calendar - p_newCalendar - the Calendar date to set the calendar to
 o getYear
 public int getYear()
gets the value of the year currently selected

Parameters:
int - - the year stored within the calendar
 o setYear
 public void setYear(int p_newYear)
sets the year within the calendar

Parameters:
int - p_newYear - the new year to set the calendar to
 o getMonth
 public int getMonth()
gets the month currently selected within the calendar.

Returns:
int - the current month selected within the calendar.
 o setMonth
 public void setMonth(int p_newMonth)
sets the month within the calendar.

Parameters:
int - p_newMonth - the new month to set the calendar to.
 o getDay
 public int getDay()
gets the day of the month currently selected

Returns:
int - the current day of the month
 o setDay
 public void setDay(int p_newDay)
sets the day of the current month within the calendar

Parameters:
int - p_newDay - the new day of the month to set the calendar to.
 o getCalendar
 public Calendar getCalendar()
gets the calendars' current date in the form of java.util.Calenar.

Returns:
Calendar - the current date selected within the calendar
See Also:
Calendar
 o actionPerformed
 public void actionPerformed(ActionEvent e)
notifies the calendar when some action has been performed that is should be aware of.

Parameters:
ActionEvent - e - the ActionEvent fired by one of its internal components.
 o setWeekDayBackground
 public void setWeekDayBackground(Color p_newColor)
sets the Week Day Cells' background.

Parameters:
Color - p_newColor - the new background color for the week day cells.
 o setWeekDayForeground
 public void setWeekDayForeground(Color p_newColor)
sets the Week Day Cells' foreground

Parameters:
Color - p_newColor - the new foreground color for the week day cells.
 o setDayForeground
 public void setDayForeground(Color p_newColor)
sets the Day Cells' foreground

Parameters:
Color - p_newColor - the new foreground color for the day cells.
 o setDayBackground
 public void setDayBackground(Color p_newColor)
sets the Day Cells' background

Parameters:
Color - p_newColor - the new background color for the day cells.
 o setActiveForeground
 public void setActiveForeground(Color p_newColor)
sets the Active Cell's foreground color. Since there is nothing shown in the blank cell's foreground, this will not display anything unless over written.

Parameters:
Color - p_newColor - the new color for the selected or active cell
 o setActiveBackground
 public void setActiveBackground(Color p_newColor)
sets the Active Cells' background color.

Parameters:
Color - p_newColor - the new color for the selected or active cell
 o setBlankForeground
 public void setBlankForeground(Color p_newColor)
sets the Blank Days Cells' foreground color.

Parameters:
Color - p_newColor - the new color for the blank cells.
 o setBlankBackground
 public void setBlankBackground(Color p_newColor)
sets the Blank Days Cells' background color.

Parameters:
Color - p_newColor - the new color for the blank cells.
 o setWeekDayGridColor
 public void setWeekDayGridColor(Color p_newColor)
sets the grid color for the Week Day Cells. The flag for showing the grid must be true to see effect.

Parameters:
Color - p_newColor - the new color for the week days grid.
 o setDayGridColor
 public void setDayGridColor(Color p_newColor)
sets the grid color for the Day Cells. The flag for showing the grid must be true to see effect.

Parameters:
Color - p_newColor - the new color for the day grid.
 o setBlankGridColor
 public void setBlankGridColor(Color p_newColor)
sets the grid color for the Blank Cells. The flag for showing the grid must be true to see the effect.

Parameters:
Color - p_newColor - the new color for the blank day grid.
 o setShowGrid
 public void setShowGrid(boolean p_showGrid)
turns on/off the grid within the calendar.

Parameters:
boolean - p_showGrid - true will show the grid, false will not show grid
 o setShowOpaque
 public void setShowOpaque(boolean p_showOpaque)
turs on/off the background colors in the cells of the calendar.

Parameters:
boolean - p_showOpaque - true will show the background color of the container in the cells, false will show the background colors for each of the cells types (Week Day, Day, Active, and Blank).
 o setCalendarFont
 public void setCalendarFont(Font p_newFont)
sets the Font to be used within the foreground of all the cells.

Parameters:
Font - p_newFont - the new Font type to use within the calendar
 o addActionListener
 public void addActionListener(ActionListener p_listener)
adds a ActionListener to the calendar's list of action listners to be notified when the calendar fires an ActionEvent. The only action event genereated is when this calendar is ready to exit. The Action Command will be 'DISPOSE' when this occurs.

Parameters:
ActionListener - p_listener - a ActionListener to recieve action events when fired.
 o setDateAndExit
 public void setDateAndExit(int p_newDay)
This is called when the user selects a new date. This will not always cause the calendar to disappear. Instead, it will fire an ActionEvent with 'DISPOSE' as the Action Command, in case another class wishes to close it (namely the one that created it).

Parameters:
int - p_newDay - the new day to be selected.

All Packages  Class Hierarchy  This Package  Previous  Next  Index