Java Reference
In-Depth Information
In essence, a DateField is an editor for a java.util.Date . As you saw in Chapter 4, Date s
represent points in time. DateField takes the role of translating between a Date and strings that
humans can read, much like the Calendar class. You can set or get the Date represented by the
DateField using the following methods:
public Date getDate()
public void setDate(Date date)
In the J2ME Wireless Toolkit emulator, a DateField appears as shown in Figure 6-9a. Note
that if you do not supply a Date to setDate() before showing the DateField , it will appear unini-
tialized, as shown in Figure 6-9b.
When the user selects either the date or time portion of the DateField for editing, the MIDP
implementation provides some kind of appropriate editor. Sun's emulator provides the editors
shown in Figure 6-9c and Figure 6-9d.
(a)
(b)
(c)
(d)
Figure 6-9. DateField in Sun's MIDP 2.0 emulator
Search WWH ::




Custom Search