public class GenericClock
extends javax.swing.SwingWorker<java.lang.Integer,java.lang.String>
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.String |
clockToPrint
Textual representation of the time value -hour, minute and seconds-.
|
(package private) boolean |
clockToPrintBlink
Modifies the textual representation of the time value.
|
(package private) int |
hour
Clock time components.
|
(package private) javax.swing.JLabel |
label
GUI Label attached to the clock, used to represent time values.
|
(package private) int |
minute
Clock time components.
|
(package private) boolean |
paused
Behaviour control variable.
|
(package private) int |
second
Clock time components.
|
(package private) boolean |
stopped
Behaviour control variable.
|
Constructor and Description |
---|
GenericClock()
Default constructor.
|
GenericClock(int hour,
int minute,
int second,
javax.swing.JLabel label)
Creates Clock with initial time value and assigned GUI label.
|
GenericClock(javax.swing.JLabel label)
Creates Clock that matchs the System Time.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Integer |
doInBackground()
Core functionality of GenericClock.
|
void |
pauseClock()
Pauses clock.
|
protected java.lang.String |
printClock()
Prints time value in the attached label.
|
void |
startClock()
Starts clock.
|
void |
stopClock()
Stops the clock.
|
protected void |
updateClock()
Updates clock, increasing the second counter by one.
|
int hour
int minute
int second
final javax.swing.JLabel label
boolean paused
boolean stopped
java.lang.String clockToPrint
boolean clockToPrintBlink
public GenericClock()
public GenericClock(int hour, int minute, int second, javax.swing.JLabel label)
hour
- hour value (min. value 0; max. value 23).minute
- minute value (min. value 0; max. value 59).second
- seconds value (min. value 0; max. value 59).label
- GUI label to be attached to the clock.public GenericClock(javax.swing.JLabel label)
label
- label to be attached to the clock.protected java.lang.Integer doInBackground() throws java.lang.Exception
doInBackground
in class javax.swing.SwingWorker<java.lang.Integer,java.lang.String>
java.lang.Exception
- SwingWorker exception.SwingWorker
,
SwingWorker.doInBackground()
protected void updateClock()
protected java.lang.String printClock()
public void pauseClock()
paused
public void startClock()
public void stopClock()
stopped
,
pauseClock()