You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DigitalClock.java 547B

1234567891011121314151617181920212223242526
  1. package clock;
  2. public class DigitalClock implements Clock {
  3. private ClockTimer subject;
  4. public DigitalClock(ClockTimer subject) {
  5. super();
  6. this.subject = subject;
  7. this.subject.addObserver(this);
  8. }
  9. public void removeObserver(Object observer) {
  10. this.subject.observers.remove(observer);
  11. }
  12. public void update(ClockTimer subject, Object args) {
  13. if (this.subject == subject) {
  14. this.draw();
  15. }
  16. }
  17. public void draw() {
  18. int hour = this.subject.getHour();
  19. int minute = this.subject.getMinute();
  20. }
  21. }