|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.View
javax.swing.text.html.ImageView
public class ImageView
A view, representing a single image, represented by the HTML IMG tag.
Field Summary |
---|
Fields inherited from class javax.swing.text.View |
---|
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary | |
---|---|
ImageView(Element element)
Creates the image view that represents the given element. |
Method Summary | |
---|---|
float |
getAlignment(int axis)
Get the image alignment. |
String |
getAltText()
Get the text that should be shown as the image replacement and also as the image tool tip text. |
AttributeSet |
getAttributes()
Returns the combination of the document and the style sheet attributes. |
Image |
getImage()
Get the image to render. |
URL |
getImageURL()
Get the URL location of the image to render. |
Icon |
getLoadingImageIcon()
Get the icon that should be displayed while the image is loading and hence not yet available. |
boolean |
getLoadsSynchronously()
Get the image loading strategy. |
Icon |
getNoImageIcon()
Get the icon that should be displayed when the image is not available. |
float |
getPreferredSpan(int axis)
Get the preferred span of the image along the axis. |
protected StyleSheet |
getStyleSheet()
Get the associated style sheet from the document. |
String |
getToolTipText(float x,
float y,
Shape shape)
Get the tool tip text. |
Shape |
modelToView(int pos,
Shape area,
Position.Bias bias)
This is currently implemented always to return the area of the image view, as the image is not divideable by character positions. |
void |
paint(Graphics g,
Shape bounds)
Paints the image or one of the two image state icons. |
void |
setLoadsSynchronously(boolean load_on_demand)
Set if the image should be loaded only when needed (synchronuosly). |
protected void |
setPropertiesFromAttributes()
Update all cached properties from the attribute set, returned by the getAttributes() . |
void |
setSize(float width,
float height)
Starts loading the image asynchronuosly. |
int |
viewToModel(float x,
float y,
Shape shape,
Position.Bias[] bias)
Maps the picture co-ordinates into the image position in the model. |
Methods inherited from class javax.swing.text.View |
---|
append, breakView, changedUpdate, createFragment, dump, forwardUpdate, forwardUpdateToView, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, setParent, updateChildren, updateLayout, viewToModel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageView(Element element)
element
- the element, represented by this image view.Method Detail |
---|
public float getAlignment(int axis)
getAlignment
in class View
axis
- -
either X_AXIS or Y_AXIS
public String getAltText()
HTML.Attribute.ALT
. If there is no such attribute, the image
name from the url is returned. If the URL is not available, the empty
string is returned.
public AttributeSet getAttributes()
getAttributes
in class View
public Image getImage()
public URL getImageURL()
public Icon getLoadingImageIcon()
public boolean getLoadsSynchronously()
public Icon getNoImageIcon()
public float getPreferredSpan(int axis)
HTML.Attribute.WIDTH
and
HTML.Attribute.HEIGHT
. If they are missing, and the image is already
loaded, the image size is returned. If there are no attributes, and the
image is not loaded, zero is returned.
getPreferredSpan
in class View
axis
- -
either X_AXIS or Y_AXIS
protected StyleSheet getStyleSheet()
public String getToolTipText(float x, float y, Shape shape)
getAltText()
. The parameters are ignored.
getToolTipText
in class View
public void paint(Graphics g, Shape bounds)
paint
in class View
g
- the Graphics, used for painting.bounds
- the bounds of the region where the image or replacing icon must be
painted.public void setLoadsSynchronously(boolean load_on_demand)
getLoadingImageIcon()
, is displayed.
protected void setPropertiesFromAttributes()
getAttributes()
.
public int viewToModel(float x, float y, Shape shape, Position.Bias[] bias)
viewToModel
in class View
x
- the x coordinate in the view spacey
- the y coordinate in the view spaceshape
- the allocation of this View
bias
- the bias to use
x, y
public Shape modelToView(int pos, Shape area, Position.Bias bias) throws BadLocationException
modelToView
in class View
pos
- character positionarea
- of the image viewbias
- bias
BadLocationException
- if pos
is invalidpublic void setSize(float width, float height)
setLoadsSynchronously(boolean)
must be
called before calling this method. The passed parameters are not used.
setSize
in class View
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |