All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class net.e2technologies.util.ETimeChooser

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

public class ETimeChooser
extends JPanel
implements Runnable, FocusListener, MouseListener
ETimeChooser is a component that is used to set time in hours, minutes, seconds, and AM or PM. This class combines the functionality of ENumericSpinner and ETextSpinner to achieve this. All the fields (hour, minute, second, and AM/PM) can be set by setting the focus to these fields and either pressing the Up or Down buttons or by the Up Arrow or Down Arrow keys. The hour field's valid values range between 0 - 12. The minute and second field's value values range between 0 -59. The AM/PM will toggle between 'AM' and 'PM'.

See Also:
ENumericSpinner, ETextSpinner

Constructor Index

 o ETimeChooser()
Default constructor for ETimerChooser.
 o ETimeChooser(ETimeListener)
 o ETimeChooser(int, int, int, boolean)
Constructor for ETimeChooser.
 o ETimeChooser(int, int, int, boolean, ETimeListener)
Constructor for ETimeChooser.

Method Index

 o actionPerformed(ActionEvent)
Notification that a sub component has performed an actions.
 o addETimeListener(ETimeListener)
Registers a new listener to be called back when the time changes within this component.
 o focusGained(FocusEvent)
Notification that a sub component has gained its focus.
 o focusLost(FocusEvent)
Notification that a sub component has lost its focus.
 o getCalendar()
gets the current time stored within the ETimeChooser component via a Calendar object.
 o getHours()
gets the value of the hours field
 o getMinutes()
gets the value of the minutes field
 o getSeconds()
gets the value of the seconds field
 o isAM()
gets the value in the AM/PM field.
 o mouseClicked(MouseEvent)
Does nothing.
 o mouseEntered(MouseEvent)
Does nothing.
 o mouseExited(MouseEvent)
Called when the user leaves one of the sup components.
 o mousePressed(MouseEvent)
Called when the user presses one of the buttons.
 o mouseReleased(MouseEvent)
Called when the user releases one of the buttons.
 o removeETimeListener(ETimeListener)
Remove registerd listener to be called back when the time changes within this component.
 o run()
Threading method used for when the user hold down a button.
 o setAM(boolean)
sets the value in the AM/PM field
 o setHours(int)
sets the value in the hours field.
 o setMinutes(int)
sets the value in the mintues field.
 o setSeconds(int)
sets the value in the seconds field.
 o setTime(Calendar)
Sets the time within the ETimeChooser.

Constructors

 o ETimeChooser
 public ETimeChooser()
Default constructor for ETimerChooser. The time will be set to the current time automatically.

 o ETimeChooser
 public ETimeChooser(ETimeListener p_listener)
 o ETimeChooser
 public ETimeChooser(int p_hour,
                     int p_minutes,
                     int p_seconds,
                     boolean p_am)
Constructor for ETimeChooser. Will set the time according to parameters passed. Remember that this component is based on standard time and not military (24 hour) time. Therefore the hours should be between 1 - 12 and AM/PM set.

Parameters:
int - p_hour - the value to set the hour field to
int - p_minutes - the value to set the minutes field to
int - p_seconds - the value to set the seconds field to
boolena - p_am - true if setting to AM, false if setting to PM
 o ETimeChooser
 public ETimeChooser(int p_hour,
                     int p_minutes,
                     int p_seconds,
                     boolean p_am,
                     ETimeListener p_listener)
Constructor for ETimeChooser. Will set the time according to parameters passed. This component is based on standard time and not military (24 hour) time. Therefore the hours should be between 1 -12 and AM/PM should be set.

Parameters:
int - p_hour - the value to set the hour field to
int - p_minutes - the value to set the minutes field to
int - p_seconds - the value to set the seconds field to
boolean - p_am - true if settting to AM, false if setting to PM
ETimeListener - p_listener - the Listener object that will be called back when a new time is selected. This happens every time the value is changed.

Methods

 o addETimeListener
 public void addETimeListener(ETimeListener p_listener)
Registers a new listener to be called back when the time changes within this component.

Parameters:
ETimeListener - p_listener - the Listener object to call back.
 o removeETimeListener
 public void removeETimeListener(ETimeListener p_listener)
Remove registerd listener to be called back when the time changes within this component.

Parameters:
ETimeListener - p_listener - the Listener object to remove.
 o actionPerformed
 public void actionPerformed(ActionEvent e)
Notification that a sub component has performed an actions. This listens for the up and down button to be pressed.

Parameters:
ActionEvent - e
 o focusLost
 public void focusLost(FocusEvent e)
Notification that a sub component has lost its focus. This will trigger the ETimeChooser to notify its listeners of the time it contains by calling setCalendar() on all listeners.

Parameters:
FocusEvent - e
See Also:
ETimeListener
 o focusGained
 public void focusGained(FocusEvent e)
Notification that a sub component has gained its focus. This will allow the ETimeChooser to internally set the current sub component to track its events.

Parameters:
FocusEvent - e
 o setTime
 public void setTime(Calendar p_calendar)
Sets the time within the ETimeChooser.

Parameters:
Calendar - p_calendar - the calendar object containing the new time that the ETimeChooser should be set to.
 o getHours
 public int getHours()
gets the value of the hours field

Returns:
int - the current value of hours
 o setHours
 public void setHours(int p_hours)
sets the value in the hours field. Remember this should be between 1 and 12.

Parameters:
int - p_hours - the value to set the hours field to.
 o getMinutes
 public int getMinutes()
gets the value of the minutes field

Returns:
int - the current value of mintues
 o setMinutes
 public void setMinutes(int p_minutes)
sets the value in the mintues field.

Parameters:
int - p_minutes - the value to set the minutes field to
 o getSeconds
 public int getSeconds()
gets the value of the seconds field

Returns:
int - the current value of seconds
 o setSeconds
 public void setSeconds(int p_seconds)
sets the value in the seconds field.

Parameters:
int - p_seconds - the value to set the seconds field to
 o setAM
 public void setAM(boolean p_isAM)
sets the value in the AM/PM field

Parameters:
boolean - p_isAm - true sets the AM/PM to AM, false to PM
 o isAM
 public boolean isAM()
gets the value in the AM/PM field.

Returns:
boolean - true is AM, false is PM
 o getCalendar
 public Calendar getCalendar()
gets the current time stored within the ETimeChooser component via a Calendar object.

Returns:
Calendar - the current time as stored within this component
 o run
 public void run()
Threading method used for when the user hold down a button. It will wait for a second and call the buttonPushed method to simulate multiple button presses.

 o mousePressed
 public final void mousePressed(MouseEvent event)
Called when the user presses one of the buttons. Will call mousePressedOn() with the appropriate button.

 o mouseReleased
 public final void mouseReleased(MouseEvent event)
Called when the user releases one of the buttons. Will call mousePressedOn() with null so that it can let the component to know to stop incrementing/decrementing values.

 o mouseExited
 public final void mouseExited(MouseEvent event)
Called when the user leaves one of the sup components. Will call mousePressedOn() with null so that the value can be checked to see if it changed.

 o mouseClicked
 public void mouseClicked(MouseEvent e)
Does nothing. Had to be implemented because of MouseListener interface

 o mouseEntered
 public void mouseEntered(MouseEvent e)
Does nothing. Had to be implemented because of MouseListener interface


All Packages  Class Hierarchy  This Package  Previous  Next  Index