All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.util.html.HTMLText

java.lang.Object
   |
   +----com.ibm.as400.util.html.HTMLText

public class HTMLText
extends Object
implements HTMLTagElement, HTMLConstants, Serializable
The HTMLText class encapsulates HTML text attributes.

This example creates an HTMLText object and sets its attributes.

  HTMLText text = new HTMLText("IBM");
  text.setBold(true);
  text.setSize(3);
  System.out.println(text.getTag());
  
Here is the output of the tag:

  <font size="3"><b>IBM</b></font>
  

HTMLText objects generate the following events:


Constructor Index

 o HTMLText()
Constructs a default HTMLText object.
 o HTMLText(String)
Constructs an HTMLText object with the specified text.

Method Index

 o addPropertyChangeListener(PropertyChangeListener)
Adds a PropertyChangeListener.
 o addVetoableChangeListener(VetoableChangeListener)
Adds the VetoableChangeListener.
 o getAlignment()
Returns the horizontal alignment.
 o getColor()
Returns the color used to paint the text.
 o getSize()
Returns the font text size.
 o getTag()
Returns the text tag.
 o getTag(boolean)
Returns the text tag.
 o getTag(String)
Returns the text tag with the specified text.
 o getTag(String, boolean)
Returns the text tag with the specified text.
 o getText()
Returns the text.
 o isBold()
Indicates if bold is on.
 o isFixed()
Indicates if fixed pitch font is on.
 o isItalic()
Indicates if italic is on.
 o isUnderscore()
Indicates if underline is on.
 o removePropertyChangeListener(PropertyChangeListener)
Removes the PropertyChangeListener from the internal list.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes the VetoableChangeListener from the internal list.
 o setAlignment(String)
Sets the horizontal alignment.
 o setBold(boolean)
Sets bold on or off.
 o setColor(Color)
Sets the color used to paint the text.
 o setFixed(boolean)
Sets fixed pitch font on or off.
 o setItalic(boolean)
Sets italic on or off.
 o setSize(int)
Sets the text font size.
 o setText(String)
Sets the text.
 o setUnderscore(boolean)
Sets underline on or off.
 o toString()
Returns the HTML text tag.

Constructors

 o HTMLText
 public HTMLText()
Constructs a default HTMLText object.

 o HTMLText
 public HTMLText(String text)
Constructs an HTMLText object with the specified text.

Parameters:
text - The text.

Methods

 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method is called each time the value of any bound property is changed.

Parameters:
listener - The PropertyChangeListener.
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
 public void addVetoableChangeListener(VetoableChangeListener listener)
Adds the VetoableChangeListener. The specified VetoableChangeListener's vetoableChange method is called each time the value of any constrained property is changed.

Parameters:
listener - The VetoableChangeListener.
See Also:
removeVetoableChangeListener
 o getAlignment
 public String getAlignment()
Returns the horizontal alignment.

Returns:
The horizontal alignment. One of the following constants defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY.
See Also:
HTMLConstants
 o getColor
 public Color getColor()
Returns the color used to paint the text.

Returns:
The Color object representing the text color.
 o getSize
 public int getSize()
Returns the font text size. The default value is 0 (browser default).

Returns:
The font size.
 o getTag
 public String getTag()
Returns the text tag. The alignment tag is not included.

Returns:
The tag.
 o getTag
 public String getTag(boolean useAlignment)
Returns the text tag.

Parameters:
useAlignment - true if the alignment tag should be included; false otherwise.
Returns:
The tag.
 o getTag
 public String getTag(String text)
Returns the text tag with the specified text. The alignment tag is not included.

Parameters:
text - The text.
Returns:
The tag.
 o getTag
 public String getTag(String text,
                      boolean useAlignment)
Returns the text tag with the specified text.

Parameters:
text - The text.
useAlignment - true if the alignment tag should be included; false otherwise.
Returns:
The tag.
 o getText
 public String getText()
Returns the text.

Returns:
The text.
 o isBold
 public boolean isBold()
Indicates if bold is on.

Returns:
true if bold, false otherwise.
 o isFixed
 public boolean isFixed()
Indicates if fixed pitch font is on.

Returns:
true if fixed, false otherwise.
 o isItalic
 public boolean isItalic()
Indicates if italic is on.

Returns:
true if italic, false otherwise.
 o isUnderscore
 public boolean isUnderscore()
Indicates if underline is on.

Returns:
true if underline, false otherwise.
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the PropertyChangeListener from the internal list. If the PropertyChangeListener is not on the list, nothing is done.

Parameters:
listener - The PropertyChangeListener.
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
 public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes the VetoableChangeListener from the internal list. If the VetoableChangeListener is not on the list, nothing is done.

Parameters:
listener - The VetoableChangeListener.
See Also:
addVetoableChangeListener
 o setAlignment
 public void setAlignment(String alignment) throws PropertyVetoException
Sets the horizontal alignment.

Parameters:
alignment - The horizontal alignment. One of the following constants defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY.
Throws: PropertyVetoException
If the change is vetoed.
See Also:
HTMLConstants
 o setBold
 public void setBold(boolean bold) throws PropertyVetoException
Sets bold on or off. The default is false.

Parameters:
bold - true if on, false if off.
Throws: PropertyVetoException
If the change is vetoed.
 o setColor
 public void setColor(Color color) throws PropertyVetoException
Sets the color used to paint the text. The default text color is determined by the browser's color settings). How the color is rendered is browser dependent.

Parameters:
color - The Color object.
Throws: PropertyVetoException
If the change is vetoed.
 o setFixed
 public void setFixed(boolean fixed) throws PropertyVetoException
Sets fixed pitch font on or off. The default is false.

Parameters:
fixed - true if on, false if off.
Throws: PropertyVetoException
If the change is vetoed.
 o setItalic
 public void setItalic(boolean italic) throws PropertyVetoException
Sets italic on or off. The default is false.

Parameters:
italic - true if on, false if off.
Throws: PropertyVetoException
If the change is vetoed.
 o setSize
 public void setSize(int size) throws PropertyVetoException
Sets the text font size. Valid values are: 0 to 7. The default value is 0 (use browser default).

Parameters:
size - The font size.
Throws: PropertyVetoException
If the change is vetoed.
 o setText
 public void setText(String text) throws PropertyVetoException
Sets the text.

Parameters:
text - The text.
Throws: PropertyVetoException
If the change is vetoed.
 o setUnderscore
 public void setUnderscore(boolean underscore) throws PropertyVetoException
Sets underline on or off. The default is false.

Parameters:
underscore - true if on, false if off.
Throws: PropertyVetoException
If the change is vetoed.
 o toString
 public String toString()
Returns the HTML text tag.

Returns:
The tag.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index