HTML Text class
The
HTMLText class allows you to access text properties for your
HTML page. Using the HTMLText class, you can get, set and check the
status of many text attributes, including:
- Get
or
set the size of the font
-
Set the bold attribute on (true) or off (false) or determine if
it is already
on
-
Set the underscore attribute on (true) or off (false) or
determine if it is already
on
-
Get or
set the horizontal alignment of the text
The following example shows you how to create an HTMLText object
and set its bold attribute on and its font size to 5.
HTMLText text = new HTMLText("IBM");
text.setBold(true);
text.setSize(5);
System.out.println(text.getTag());
The print statement produces the following tag:
<font size="5"><b>IBM</b></font>
When you use this tag in an HTML page, it looks like this:
IBM