Class HilitCanvas
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----HilitCanvas
- public abstract class HilitCanvas
- extends Canvas
This class provides a set of canvases, each capable of
trapping user events. If the mouse is positioned over one
of them, it displays an alternate (highlight) image.
Highlight and normal images may be of different dimensions; they
will both be centered on the coordinates given to the constructor.
mouseDown is an abstract function; it is expected that each class will
want to do something when the mouse is clicked.
-
hilitOff()
- Turn highlighting off.
-
hilitOn()
- Turn highlighting on.
-
isHilit()
- Show if this object is highlighted.
-
mouseDown(Event, int, int)
- Do something when the mouse is clicked.
-
mouseEnter(Event, int, int)
- Highlight this object when the mouse enters it.
-
mouseExit(Event, int, int)
- Un-highlight this object when the mouse leaves it.
-
paint(Graphics)
- Paint either the highlight or non-highlight
image, with appropriate offsets,
depending upon the state of the object.
-
setCenter(int, int)
- Move the canvas.
-
setImageOff(Image)
- Set the non-highlighted image.
-
setImageOn(Image)
- Set the highlighted image.
paint
public void paint(Graphics g)
- Paint either the highlight or non-highlight
image, with appropriate offsets,
depending upon the state of the object.
- Overrides:
- paint in class Canvas
isHilit
public boolean isHilit()
- Show if this object is highlighted.
mouseDown
public abstract boolean mouseDown(Event e,
int x,
int y)
- Do something when the mouse is clicked.
- Overrides:
- mouseDown in class Component
mouseEnter
public boolean mouseEnter(Event e,
int x,
int y)
- Highlight this object when the mouse enters it.
Extended classes may wish to overload this function so that it
only happens under certain circumstances.
- Overrides:
- mouseEnter in class Component
mouseExit
public boolean mouseExit(Event e,
int x,
int y)
- Un-highlight this object when the mouse leaves it.
Extended classes may wish to overload this function so that it
only happens under certain circumstances.
- Overrides:
- mouseExit in class Component
setImageOn
protected void setImageOn(Image i)
- Set the highlighted image.
- Parameters:
- i - Image to be used
setImageOff
protected void setImageOff(Image i)
- Set the non-highlighted image.
- Parameters:
- i - Image to be used
hilitOn
protected void hilitOn()
- Turn highlighting on.
hilitOff
protected void hilitOff()
- Turn highlighting off.
setCenter
public void setCenter(int newX,
int newY)
- Move the canvas.