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
-
ETimeChooser()
- Default constructor for ETimerChooser.
-
ETimeChooser(ETimeListener)
-
-
ETimeChooser(int, int, int, boolean)
- Constructor for ETimeChooser.
-
ETimeChooser(int, int, int, boolean, ETimeListener)
- Constructor for ETimeChooser.
-
actionPerformed(ActionEvent)
- Notification that a sub component has performed an actions.
-
addETimeListener(ETimeListener)
- Registers a new listener to be called back when the time changes within this component.
-
focusGained(FocusEvent)
- Notification that a sub component has gained its focus.
-
focusLost(FocusEvent)
- Notification that a sub component has lost its focus.
-
getCalendar()
- gets the current time stored within the ETimeChooser component via a
Calendar object.
-
getHours()
- gets the value of the hours field
-
getMinutes()
- gets the value of the minutes field
-
getSeconds()
- gets the value of the seconds field
-
isAM()
- gets the value in the AM/PM field.
-
mouseClicked(MouseEvent)
- Does nothing.
-
mouseEntered(MouseEvent)
- Does nothing.
-
mouseExited(MouseEvent)
- Called when the user leaves one of the sup components.
-
mousePressed(MouseEvent)
- Called when the user presses one of the buttons.
-
mouseReleased(MouseEvent)
- Called when the user releases one of the buttons.
-
removeETimeListener(ETimeListener)
- Remove registerd listener to be called back when the time changes within this component.
-
run()
- Threading method used for when the user hold down a button.
-
setAM(boolean)
- sets the value in the AM/PM field
-
setHours(int)
- sets the value in the hours field.
-
setMinutes(int)
- sets the value in the mintues field.
-
setSeconds(int)
- sets the value in the seconds field.
-
setTime(Calendar)
- Sets the time within the ETimeChooser.
ETimeChooser
public ETimeChooser()
- Default constructor for ETimerChooser. The time will be set to the current time automatically.
ETimeChooser
public ETimeChooser(ETimeListener p_listener)
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
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.
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.
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.
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
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
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
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.
getHours
public int getHours()
- gets the value of the hours field
- Returns:
- int - the current value of hours
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.
getMinutes
public int getMinutes()
- gets the value of the minutes field
- Returns:
- int - the current value of mintues
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
getSeconds
public int getSeconds()
- gets the value of the seconds field
- Returns:
- int - the current value of seconds
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
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
isAM
public boolean isAM()
- gets the value in the AM/PM field.
- Returns:
- boolean - true is AM, false is PM
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
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.
mousePressed
public final void mousePressed(MouseEvent event)
- Called when the user presses one of the buttons. Will call mousePressedOn() with
the appropriate button.
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.
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.
mouseClicked
public void mouseClicked(MouseEvent e)
- Does nothing. Had to be implemented because of MouseListener interface
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