Class ImageBox
java.lang.Object
|
+--AbstractBox
|
+--AbstractRigidBox
|
+--ImageBox
- All Implemented Interfaces:
- Box, RigidBox
- public class ImageBox
- extends AbstractRigidBox
An image.
Constructor Summary |
ImageBox(java.net.URL img_url,
java.net.URL link_url)
Constructs an ImageBox. |
Method Summary |
void |
doLayout(java.awt.Graphics g,
javax.swing.JComponent c,
int w)
Calculates the width and height of the image. |
void |
drawAt(int x,
int y,
DocumentView v)
Draws the box with it's upper-left corner at (x ,
y ). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ImageBox
public ImageBox(java.net.URL img_url,
java.net.URL link_url)
- Constructs an ImageBox.
- Parameters:
img_url
- the URL of the image. The image isn't
downloaded until doLayout(Graphics, JComponent, int)
is called.link_url
- the URL which this image links too. If the
image doesn't link to anywhere, link_url
should
be null
.
doLayout
public void doLayout(java.awt.Graphics g,
javax.swing.JComponent c,
int w)
- Calculates the width and height of the image. The image is
downloaded and then meassured.
- Overrides:
doLayout
in class AbstractBox
- Following copied from interface:
Box
- Parameters:
g
- the graphics context. Some boxes, like TextFragments,
need a graphics context before they can determine their width
and height.c
- the component into which the box will be drawn. An
ImageBox needs to know the component to calculate the width
and height.w
- the width available for to the Box.
drawAt
public void drawAt(int x,
int y,
DocumentView v)
- Description copied from interface:
Box
- Draws the box with it's upper-left corner at (
x
,
y
).
- Overrides:
drawAt
in class AbstractBox
- Following copied from interface:
Box
- Parameters:
v
- the DocumentView
that does the actual
drawing.x
- the x-coordinate of the upper-left corner.x
- the y-coordinate of the upper-left corner.