Class ImageCanvas
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----ImageCanvas
- public class ImageCanvas
- extends Canvas
ImageCanvas is a Canvas that holds an Image. The Image can be
switched, but ImageCanvas assumes all Images have the same
dimensions of the first image.
-
ImageCanvas()
- This is provided for convenience only.
-
ImageCanvas(ImageCanvasEventHandler, Image)
- Creates an ImageCanvas with the specified event handler and
initial image.
-
draw()
- Draws the ImageCanvas
-
minimumSize()
-
-
mouseDown(Event, int, int)
- Handles a mouseDown event by calling the ImageCanvas' callback
(set in the constructor).
-
mouseUp(Event, int, int)
- Doesn't do anything right now
-
paint(Graphics)
-
-
preferredSize()
-
-
setImage(Image)
- Sets the ImageCanvas to a new Image.
ImageCanvas
public ImageCanvas()
- This is provided for convenience only. ImageCanvas objects
must be initialized by calling a constructor that has
parameters.
ImageCanvas
public ImageCanvas(ImageCanvasEventHandler handler,
Image image)
- Creates an ImageCanvas with the specified event handler and
initial image.
- Parameters:
- handler - a callback function that handles events
generated by this ImageCanvas
- Image - initial Image to be displayed. All subsequent
Images set with
setImage
should have the same
dimensions.
preferredSize
public Dimension preferredSize()
- Overrides:
- preferredSize in class Component
minimumSize
public Dimension minimumSize()
- Overrides:
- minimumSize in class Component
paint
public void paint(Graphics g)
- Overrides:
- paint in class Canvas
draw
public void draw()
- Draws the ImageCanvas
setImage
public void setImage(Image image)
- Sets the ImageCanvas to a new Image. This should have the same
dimensions as the initial Image.
mouseDown
public boolean mouseDown(Event event,
int x,
int y)
- Handles a mouseDown event by calling the ImageCanvas' callback
(set in the constructor).
- Overrides:
- mouseDown in class Component
mouseUp
public boolean mouseUp(Event event,
int x,
int y)
- Doesn't do anything right now
- Overrides:
- mouseUp in class Component