Calendar Widget

By Rakesh Menon, December 8, 2008

This sample demonstrates how to write simple Calendar widget with theme support using Common Profile APIs. The widget can be executed as standalone application, in browser and mobile. The widget can be dragged onto desktop. Use Alt + Left click + Drag to drag the applet out of browser. The theme can be changed by clicking on top of calendar.

Understanding the Code

The Cell class is javafx.scene.CustomNode which has a Rectangle and Text. The background of rectangle and text color are filled with information obtained from Theme class. All paint properties are linked to corresponding attributes in Theme class using bind.

A sequence of Cell is created to form the calendar user interface. The date information is obtained using java.util.Calendar APIs.

References