Time for action – responding to input
To show the effect of changing the TimeZone
, it is necessary to add an hour hand to the clock. When the TimeZone
is changed in the drop-down, the hour hand will be updated.
- Add a
zone
field to theClockWidget
along with a setter:private ZoneId zone = ZoneId.systemDefault(); public void setZone(ZoneId zone) { this.zone = zone; }
- Getters and setters can be generated automatically. Once the field is added, navigate to Source | Generate Getters and Setters. It can be used to generate all missing getters and/or setters; in addition, a single getter/setter can be generated by typing
set
in the class body, followed by Ctrl + Space (Cmd + Space on macOS). - Add an hour hand in the
drawClock
method using the following: ...
Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.