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.


Method Index

 o hilitOff()
Turn highlighting off.
 o hilitOn()
Turn highlighting on.
 o isHilit()
Show if this object is highlighted.
 o mouseDown(Event, int, int)
Do something when the mouse is clicked.
 o mouseEnter(Event, int, int)
Highlight this object when the mouse enters it.
 o mouseExit(Event, int, int)
Un-highlight this object when the mouse leaves it.
 o paint(Graphics)
Paint either the highlight or non-highlight image, with appropriate offsets, depending upon the state of the object.
 o setCenter(int, int)
Move the canvas.
 o setImageOff(Image)
Set the non-highlighted image.
 o setImageOn(Image)
Set the highlighted image.

Methods

 o 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
 o isHilit
 public boolean isHilit()
Show if this object is highlighted.

 o mouseDown
 public abstract boolean mouseDown(Event e,
                                   int x,
                                   int y)
Do something when the mouse is clicked.

Overrides:
mouseDown in class Component
 o 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
 o 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
 o setImageOn
 protected void setImageOn(Image i)
Set the highlighted image.

Parameters:
i - Image to be used
 o setImageOff
 protected void setImageOff(Image i)
Set the non-highlighted image.

Parameters:
i - Image to be used
 o hilitOn
 protected void hilitOn()
Turn highlighting on.

 o hilitOff
 protected void hilitOff()
Turn highlighting off.

 o setCenter
 public void setCenter(int newX,
                       int newY)
Move the canvas.