java.lang.ObjectClockDisplay
public class ClockDisplay
The ClockDisplay class implements a digital clock display for a European-style 24 hour clock. The clock shows hours, minutes and seconds. The range of the clock is 00:00:00 (midnight) to 23:59:59 (one second before midnight). The clock display receives "ticks" (via the timeTick method) every second and reacts by incrementing the display. This is done in the usual clock fashion: the hour increments when the minutes roll over to zero and the minute increments when the seconds roll over to zero.
Constructor Summary | |
---|---|
ClockDisplay()
Constructor for ClockDisplay objects. |
|
ClockDisplay(int hour,
int minute,
int second)
Constructor for ClockDisplay objects. |
Method Summary | |
---|---|
java.lang.String |
getTime()
Return the current time of this display in the format HH:MM:SS. |
void |
setTime(int hour,
int minute,
int second)
Set the time of the display to the specified hour, minute and second. |
void |
timeTick()
This method should get called once every second - it makes the clock display go one second forward. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClockDisplay()
public ClockDisplay(int hour, int minute, int second)
Method Detail |
---|
public java.lang.String getTime()
public void setTime(int hour, int minute, int second)
public void timeTick()