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:
- PropertyChangeEvent
- VetoableChangeEvent
-
HTMLText()
- Constructs a default HTMLText object.
-
HTMLText(String)
- Constructs an HTMLText object with the specified text.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a PropertyChangeListener.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds the VetoableChangeListener.
-
getAlignment()
- Returns the horizontal alignment.
-
getColor()
- Returns the color used to paint the text.
-
getSize()
- Returns the font text size.
-
getTag()
- Returns the text tag.
-
getTag(boolean)
- Returns the text tag.
-
getTag(String)
- Returns the text tag with the specified text.
-
getTag(String, boolean)
- Returns the text tag with the specified text.
-
getText()
- Returns the text.
-
isBold()
- Indicates if bold is on.
-
isFixed()
- Indicates if fixed pitch font is on.
-
isItalic()
- Indicates if italic is on.
-
isUnderscore()
- Indicates if underline is on.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes the PropertyChangeListener from the internal list.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes the VetoableChangeListener from the internal list.
-
setAlignment(String)
- Sets the horizontal alignment.
-
setBold(boolean)
- Sets bold on or off.
-
setColor(Color)
- Sets the color used to paint the text.
-
setFixed(boolean)
- Sets fixed pitch font on or off.
-
setItalic(boolean)
- Sets italic on or off.
-
setSize(int)
- Sets the text font size.
-
setText(String)
- Sets the text.
-
setUnderscore(boolean)
- Sets underline on or off.
-
toString()
- Returns the HTML text tag.
HTMLText
public HTMLText()
- Constructs a default HTMLText object.
HTMLText
public HTMLText(String text)
- Constructs an HTMLText object with the specified text.
- Parameters:
- text - The text.
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
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
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
getColor
public Color getColor()
- Returns the color used to paint the text.
- Returns:
- The Color object representing the text color.
getSize
public int getSize()
- Returns the font text size.
The default value is 0 (browser default).
- Returns:
- The font size.
getTag
public String getTag()
- Returns the text tag. The alignment tag is not included.
- Returns:
- The tag.
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.
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.
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.
getText
public String getText()
- Returns the text.
- Returns:
- The text.
isBold
public boolean isBold()
- Indicates if bold is on.
- Returns:
- true if bold, false otherwise.
isFixed
public boolean isFixed()
- Indicates if fixed pitch font is on.
- Returns:
- true if fixed, false otherwise.
isItalic
public boolean isItalic()
- Indicates if italic is on.
- Returns:
- true if italic, false otherwise.
isUnderscore
public boolean isUnderscore()
- Indicates if underline is on.
- Returns:
- true if underline, false otherwise.
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
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
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
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.
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.
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.
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.
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.
setText
public void setText(String text) throws PropertyVetoException
- Sets the text.
- Parameters:
- text - The text.
- Throws: PropertyVetoException
- If the change is vetoed.
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.
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