Talk:Building a Java ME Canvas based calendar/date picker
The code example shows how to create the calendar control using low-level drawing operations. Example code is given demonstrating how to implement the calendar control using a Canvas. The widget also provides several customizable properties, such as the fonts used and the background and foreground colors. The widget is also linked to an instance of the Calendar class in java.util which is used to retrieve information regarding which day of the week a month starts on.
The result of the code is a very professional looking and customizable widget which would be a useful addition to any midlet which requires users to enter date information. When a date needs to be entered, the midlet can simply redirect to a canvas displaying such a calendar control and return once the user has selected a date. The code can take care of formatting the date as required. Perhaps one drawback is that the control does not take the available screen dimensions into account, which could result in a control that doesn’t fit on the screen in smaller devices and which doesn’t make use of all the available screen space on larger devices.