Tutorial One: The Clock

For this tutorial, we will start with a simple clock form, making use of the built-in TimerBean. Once we have this clock compiled and running successfully, we will then extend its functionality, adding the ability to set the time, and change the time and date format.

Part One

Startup:
Add a component:
Modify the component's properties:

This completes the visual aspect of the first stage of this tutorial. Now we will add functionality to this form by adding the TimerBean and some code.

Functionality - Adding Code:
Add the TimerBean, and set an event handler:
Compiling and Executing the form:

That's it!

Again, assuming there are no errors, your clock should be displayed, showing the correct current time, with the seconds incrementing normally.


You've just built your first form!

To close the form, right-click on it in the Execution View, and choose Terminate Process. Note that while you can also terminate this form by closing the form window, this relies on the WindowClosing event being set. The JFrame Template we used to build this form has this event set to close the application as a default setting. Without it, closing the window would not actually terminate the process.

This concludes Part One of the Tutorial. In Tutorial One: Part Two, we will extend the functionality of this clock, adding the ability to set the current time.

Beginning Prev Next