TextField DTD and XML definitions

The TextField extends SpTextField. It has the following entry in the DTD file:
Table 1. TextField definition
Line entry in the DTD file Description
<!ELEMENT TextField EMPTY> A TextField does not contain any sub-elements
<!ATTLIST TextField
    name CDATA #IMPLIED
    width CDATA "32"
    height CDATA "22"
    x CDATA #REQUIRED
    y CDATA #REQUIRED
    focusTraversable (true|false) #IMPLIED
    horizontalAlignment CDATA "0"
    hotKey CDATA #IMPLIED
    onInitialize CDATA #IMPLIED
    text CDATA #IMPLIED>
Attribute list
Table 2. TextField attributes
Attribute Description
name Name used by the Desktop to identify this component
width Width of the text field
height Height of the text field
x Horizontal coordinate for the location of the text field (mandatory)
y Vertical coordinate for the location of the text field (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
hotKey Combination of keys used as a hot key for the text field. Pressing this combination of keys when the text field is visible on the Desktop is equivalent to clicking on the text field (which causes it to get focus).
onInitialize Java code to be executed when the component is initialized
text String to be inserted in the text field
The following is an example of an XML definition for a TextField:
<TextField name="MessageText"
    width="370" height="19"
    x="10" y="5" 
    horizontalAlignment="0" 
    focusTraversable="false" 
    onInitialize="this.setForeground(new java.awt.Color(255,0,0));" 
/>