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 and minutes. The range of the clock is 00:00 (midnight) to 23:59 (one minute before midnight). The clock display receives "ticks" (via the timeTick method) every minute and reacts by incrementing the display. This is done in the usual clock fashion: the hour increments when the minutes roll over to zero.
Constructor Summary | |
---|---|
ClockDisplay()
Constructor for ClockDisplay objects. |
|
ClockDisplay(int hour,
int minute)
Constructor for ClockDisplay objects. |
Method Summary | |
---|---|
java.lang.String |
getTime()
Return the current time of this display in the format HH:MM. |
void |
setTime(int hour,
int minute)
Set the time of the display to the specified hour and minute. |
void |
timeTick()
This method should get called once every minute - it makes the clock display go one minute 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)
Method Detail |
---|
public java.lang.String getTime()
public void setTime(int hour, int minute)
public void timeTick()