Class ClockDisplay

java.lang.Object
  extended by ClockDisplay

public class ClockDisplay
extends java.lang.Object

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.

Version:
2006.03.30
Author:
Michael Kolling and David J. Barnes

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

ClockDisplay

public ClockDisplay()
Constructor for ClockDisplay objects. This constructor creates a new clock set at 00:00.


ClockDisplay

public ClockDisplay(int hour,
                    int minute)
Constructor for ClockDisplay objects. This constructor creates a new clock set at the time specified by the parameters.

Method Detail

getTime

public java.lang.String getTime()
Return the current time of this display in the format HH:MM.


setTime

public void setTime(int hour,
                    int minute)
Set the time of the display to the specified hour and minute.


timeTick

public void timeTick()
This method should get called once every minute - it makes the clock display go one minute forward.