The Timer has the same attributes as a TextField plus one
additional attribute, pattern, for specifying the time format. The
Timer has the following entry in the DTD file:
Table 1. Timer definitionLine entry in the DTD file |
Description |
<!ELEMENT Timer EMPTY> |
A Timer does not contain any sub-elements |
<!ATTLIST Timer
name CDATA #FIXED "Timer"
width CDATA "40"
height CDATA "20"
x CDATA #REQUIRED
y CDATA #REQUIRED
focusTraversable (true|false) #IMPLIED
horizontalAlignment CDATA "0"
onInitialize CDATA #IMPLIED
pattern CDATA "HH:mm">
|
Attributes list |
Table 2. Timer attributesAttribute |
Description |
name |
Name of the component used by the Desktop for its unique identification.
This attribute is fixed, and its value is "Timer". 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 timer. |
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
|
onInitialize |
Java code to be executed
when the component is initialized |
pattern |
Time format, to be specified following the rules of the java.text.SimpleDataFormat
class |
The following is an example of an XML definition for a Timer:
<Timer name="Timer" width="41" height="20"
x="25" y="5" focusTraversable="false" />