public class HTMLText extends HTMLTagAttributes implements HTMLConstants, java.io.Serializable
This example creates an HTMLText object and sets its attributes.
Here is the output of the tag:HTMLText text = new HTMLText("IBM"); text.setBold(true); text.setSize(3); System.out.println(text.getTag());
<font size="3"><b>IBM</b></font>
Here is the output of calling getFOTag():
<fo:block font-size='9pt' font-weight='bold'>IBM</fo:block>
HTMLText objects generate the following events:
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CAPITALS, CENTER, CIRCLE, DISC, JUSTIFY, LARGE_ROMAN, LEFT, LOWER_CASE, LTR, MIDDLE, NUMBERS, RIGHT, RTL, SMALL_ROMAN, SQUARE, TARGET_BLANK, TARGET_PARENT, TARGET_SELF, TARGET_TOP, TEXTTOP, TOP
Constructor and Description |
---|
HTMLText()
Constructs a default HTMLText object.
|
HTMLText(java.lang.String text)
Constructs an HTMLText object with the specified text.
|
Modifier and Type | Method and Description |
---|---|
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds the VetoableChangeListener.
|
java.lang.String |
getAlignment()
Returns the horizontal alignment.
|
java.awt.Color |
getColor()
Returns the color used to paint the text.
|
java.lang.String |
getDirection()
Returns the direction of the text interpretation.
|
java.lang.String |
getFOTag()
Returns the XSL-FO text tag.
|
java.lang.String |
getFOTag(boolean useAlignment)
Returns the XSL-FO text tag.
|
java.lang.String |
getFOTag(java.lang.String text)
Returns the XSL-FO text tag with the specified text.
|
java.lang.String |
getFOTag(java.lang.String text,
boolean useAlignment)
Returns the XSL-FO text tag with the specified text.
|
java.lang.String |
getLanguage()
Returns the language of the text element.
|
int |
getSize()
Returns the font text size.
|
java.lang.String |
getTag()
Returns the text tag.
|
java.lang.String |
getTag(boolean useAlignment)
Returns the text tag.
|
java.lang.String |
getTag(java.lang.String text)
Returns the text tag with the specified text.
|
java.lang.String |
getTag(java.lang.String text,
boolean useAlignment)
Returns the text tag with the specified text.
|
java.lang.String |
getText()
Returns the text.
|
boolean |
isBold()
Indicates if bold is on.
|
boolean |
isFixed()
Indicates if fixed pitch font is on.
|
boolean |
isItalic()
Indicates if italic is on.
|
boolean |
isUnderscore()
Indicates if underline is on.
|
boolean |
isUseFO()
Returns if Formatting Object tags are outputted.
|
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes the VetoableChangeListener from the internal list.
|
void |
setAlignment(java.lang.String alignment)
Sets the horizontal alignment.
|
void |
setBold(boolean bold)
Sets bold on or off.
|
void |
setColor(java.awt.Color color)
Sets the color used to paint the text.
|
void |
setDirection(java.lang.String dir)
Sets the direction of the text interpretation.
|
void |
setFixed(boolean fixed)
Sets fixed pitch font on or off.
|
void |
setItalic(boolean italic)
Sets italic on or off.
|
void |
setLanguage(java.lang.String lang)
Sets the language of the text tag.
|
void |
setSize(int size)
Sets the text font size.
|
void |
setText(java.lang.String text)
Sets the text.
|
void |
setUnderscore(boolean underscore)
Sets underline on or off.
|
void |
setUseFO(boolean useFO)
Sets if Formatting Object tags should be used.
|
java.lang.String |
toString()
Returns the HTML text tag.
|
addPropertyChangeListener, getAttributes, getAttributeString, removePropertyChangeListener, setAttributes
public HTMLText()
public HTMLText(java.lang.String text)
text
- The text.public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The VetoableChangeListener.removeVetoableChangeListener(java.beans.VetoableChangeListener)
public java.lang.String getAlignment()
HTMLConstants
public java.awt.Color getColor()
public java.lang.String getDirection()
public java.lang.String getLanguage()
public int getSize()
public java.lang.String getTag()
getTag
in interface HTMLTagElement
public java.lang.String getFOTag()
getFOTag
in interface HTMLTagElement
public java.lang.String getTag(boolean useAlignment)
useAlignment
- true if the alignment tag should be included; false otherwise.public java.lang.String getFOTag(boolean useAlignment)
useAlignment
- true if the alignment tag should be included; false otherwise.public java.lang.String getTag(java.lang.String text)
text
- The text.public java.lang.String getFOTag(java.lang.String text)
text
- The text.public java.lang.String getTag(java.lang.String text, boolean useAlignment)
text
- The text.useAlignment
- true if the alignment tag should be included; false otherwise.public java.lang.String getFOTag(java.lang.String text, boolean useAlignment)
text
- The text.useAlignment
- true if the alignment tag should be included; false otherwise.public java.lang.String getText()
public boolean isBold()
public boolean isFixed()
public boolean isItalic()
public boolean isUnderscore()
public boolean isUseFO()
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The VetoableChangeListener.addVetoableChangeListener(java.beans.VetoableChangeListener)
public void setAlignment(java.lang.String alignment) throws java.beans.PropertyVetoException
alignment
- The horizontal alignment. One of the following constants
defined in HTMLConstants: LEFT, CENTER, RIGHT, or JUSTIFY.java.beans.PropertyVetoException
- If the change is vetoed.HTMLConstants
public void setBold(boolean bold) throws java.beans.PropertyVetoException
bold
- true if on, false if off.java.beans.PropertyVetoException
- If the change is vetoed.public void setColor(java.awt.Color color) throws java.beans.PropertyVetoException
color
- The Color object.java.beans.PropertyVetoException
- If the change is vetoed.public void setDirection(java.lang.String dir) throws java.beans.PropertyVetoException
dir
- The direction. One of the following constants
defined in HTMLConstants: LTR or RTL.java.beans.PropertyVetoException
- If a change is vetoed.HTMLConstants
public void setFixed(boolean fixed) throws java.beans.PropertyVetoException
fixed
- true if on, false if off.java.beans.PropertyVetoException
- If the change is vetoed.public void setItalic(boolean italic) throws java.beans.PropertyVetoException
italic
- true if on, false if off.java.beans.PropertyVetoException
- If the change is vetoed.public void setLanguage(java.lang.String lang) throws java.beans.PropertyVetoException
lang
- The language. Example language tags include:
en and en-US.java.beans.PropertyVetoException
- If a change is vetoed.public void setSize(int size) throws java.beans.PropertyVetoException
size
- The font size.java.beans.PropertyVetoException
- If the change is vetoed.public void setText(java.lang.String text) throws java.beans.PropertyVetoException
text
- The text.java.beans.PropertyVetoException
- If the change is vetoed.public void setUnderscore(boolean underscore) throws java.beans.PropertyVetoException
underscore
- true if on, false if off.java.beans.PropertyVetoException
- If the change is vetoed.public void setUseFO(boolean useFO)
useFO
- - true if output generated is an XSL formatting object, false if the output generated is HTML.public java.lang.String toString()
toString
in class java.lang.Object