public class HTMLImage extends HTMLTagAttributes implements HTMLConstants, java.io.Serializable
This example creates a HTMLImage tag:
// Create an HTMLImage. HTMLImage image = new HTMLImage("http://myWebPage/pic.gif", "alternate text"); image.setHeight(50); image.setWidth(50); System.out.println(image);
Here is the output of the HTMLImage tag:
<img src="http://myWebPage/pic.gif" alt="alternate text" height="50" width="50" />
The equivalent tag using XSL Formatting Objects looks like the following:
<fo:block> <fo:external-graphic src="file:http://myWebPage/pic.gif" content-height="50px" content-width="50px"/> </fo:block>
HTMLImage 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 |
---|
HTMLImage()
Constructs a default HTMLImage object.
|
HTMLImage(java.lang.String source,
java.lang.String alt)
Constructs an HTMLImage object with the specified source and alternate text.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAlign()
Returns the alignment of the image.
|
java.lang.String |
getAlt()
Returns the alternate text.
|
int |
getBorder()
Returns the thickness of the border around the image.
|
java.lang.String |
getFOTag()
Returns the element tag for the XSL-FO image.
|
int |
getHeight()
Returns the height of the image.
|
int |
getHSpace()
Returns the horizontal space around the image in pixels.
|
java.lang.String |
getName()
Returns the unique name of the image.
|
java.lang.String |
getSrc()
Returns the absolute or relative URL to reference the image.
|
java.lang.String |
getTag()
Returns the element tag.
|
int |
getVSpace()
Returns the vertical space around the Image in pixels.
|
int |
getWidth()
Sets the width of the image in pixels.
|
boolean |
isUseFO()
Returns if Formatting Object tags are outputted.
|
void |
setAlign(java.lang.String align)
Sets the alignment of text following the image tag relative to the graphic on screen.
|
void |
setAlt(java.lang.String alt)
Sets the alternate text to be displayed in place of the image.
|
void |
setBorder(int border)
Sets the thickness of the border around the image.
|
void |
setHeight(int height)
Sets the height of the image in pixels.
|
void |
setHSpace(int hspace)
Sets the horizontal space around the image in pixels.
|
void |
setName(java.lang.String name)
Set the a unique name of the image.
|
void |
setSrc(java.lang.String source)
Sets the absolute or relative URL to reference the image.
|
void |
setUseFO(boolean useFO)
Sets if Formatting Object tags should be used.
|
void |
setVSpace(int vspace)
Sets the vertical space around the image in pixels.
|
void |
setWidth(int width)
Sets the width of the image in pixels.
|
java.lang.String |
toString()
Returns a String representation for the HTMLImage tag.
|
addPropertyChangeListener, getAttributes, getAttributeString, removePropertyChangeListener, setAttributes
public HTMLImage()
public HTMLImage(java.lang.String source, java.lang.String alt)
source
- The absolute or relative URL.alt
- The alternate text.public java.lang.String getAlign()
public java.lang.String getAlt()
public int getBorder()
public int getHeight()
public int getHSpace()
public java.lang.String getName()
public java.lang.String getSrc()
public int getVSpace()
public int getWidth()
public java.lang.String getTag()
getTag
in interface HTMLTagElement
public java.lang.String getFOTag()
getFOTag
in interface HTMLTagElement
public boolean isUseFO()
public void setAlign(java.lang.String align)
align
- The alignment. One of the following constants
defined in HTMLConstants: LEFT, RIGHT, TOP, TEXTTOP, MIDDLE, ABSMIDDLE, BASELINE, BOTTOM, or ABSBOTTOM .HTMLConstants
public void setAlt(java.lang.String alt)
alt
- The alternate text.public void setBorder(int border)
border
- The border thickness.public void setHeight(int height)
height
- The height.public void setHSpace(int hspace)
hspace
- The horizontal space.public void setName(java.lang.String name)
name
- The name.public void setSrc(java.lang.String source)
source
- The source.public void setVSpace(int vspace)
vspace
- The vertical space.public void setWidth(int width)
width
- The width.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