DateField DTD and XML definitions

The DateField has the same attributes as a TextField plus one additional attribute, pattern, for specifying the pattern of date to be used. The DateField has the following entry in the DTD file:
Table 1. DateField definition
Line entry in the DTD file Description
<!ELEMENT DateField EMPTY> A DateField does not contain any sub-elements
<!ATTLIST DateField
    name CDATA #FIXED "DateField"
    width CDATA "75"
    height CDATA "20"
    x CDATA #REQUIRED
    y CDATA #REQUIRED
    focusTraversable (true|false) #IMPLIED
    horizontalAlignment CDATA "0"
    onInitialize CDATA #IMPLIED
    pattern CDATA "dd/MM/yy">
Attribute list
Table 2. DateField attributes
Attribute Description
name Name of the component used by the Desktop for its unique identification. This attribute is fixed, and its value is "DateField". A new class can be implemented to substitute or extend the one provided, but the name must not be changed, to allow the Desktop to identify the component as the date field.
width Width of the text field
height Height of the text field
x Horizontal coordinate for the location of the text field within its parent container (mandatory)
y Vertical coordinate for the location of the text field within its parent container (mandatory)
focus Traversable Whether the text field will be able to get focus
horizontal Alignment Horizontal alignment of the text field. Following are the possible values:
  • "0" for center alignment
  • 2" for left alignment
  • "4"for right alignment
onInitialize Java(TM) code to be executed when the component is initialized
pattern Date format, to be specified following the rules of the java.text.SimpleDateFormat class

The following is an example of an XML definition for a DateField:

<DateField name="DateField" width="74" height="20" 
   x="196" y="5" focusTraversable="false" />