Clock demo

To demonstrate the topics covered in this chapter, I have written a small clock application.

It will become more complex with each upcoming chapter; for the first release it just shows a current local time in text form and updates it every second, demonstrating Stage/Scene usage, one of the layout managers, and the Application FX Thread workflow:

See the inline comments for details about the program:

// chapter1/clock/ClockOne.javapublic class ClockOne extends Application {    // we are allowed to create UI objects on non-UI thread    private final Text txtTime = new Text();            private volatile boolean enough = false;         // this is timer ...

Get Mastering JavaFX 10 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.