Talk:Building a Java ME Canvas based calendar/date picker
This article provides a useful control for selecting dates in Java ME midlets. The example shows how to create a calendar widget, controls that have proven popular on the web (both as JavaScript and server-side controls) and in desktop applications for selecting dates. These controls help avoid problems regarding differing date formats in different countries. Furthermore, if a date must be manually entered, users are often unsure as to whether punctuation such as backslashes or hyphens is necessary.
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.

