All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.InvisibleButton

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----symantec.itools.awt.InvisibleButton

public class InvisibleButton
extends Canvas
implements TransparencyTrick
Use this component to create an invisible area, usually within an image, that initiates an action when clicked. Specifically, use InvisibleButton to Button tips:


Variable Index

 o pressed
True if the button is currently pressed.

Constructor Index

 o InvisibleButton()
Constructs an InvisibleButton.

Method Index

 o mouseDown(Event, int, int)
Processes MOUSE_DOWN events.
 o mouseUp(Event, int, int)
Processes MOUSE_UP events.
 o paint(Graphics)
Paints this component using the given graphics context.
 o update(Graphics)
Handles redrawing of this component on the screen.

Variables

 o pressed
  protected boolean pressed
True if the button is currently pressed.

Constructors

 o InvisibleButton
  public InvisibleButton()
Constructs an InvisibleButton.

Methods

 o update
  public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to prevent the flicker associated with the standard update() method's repainting of the background before painting the component itself.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o paint
  public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

It paints what is under the button, so as to appear invisible.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update
 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
Processes MOUSE_DOWN events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_DOWN event. These events occur when the mouse button is pressed while inside this component.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseDown in class Component
See Also:
mouseUp, handleEvent
 o mouseUp
  public boolean mouseUp(Event e,
                         int x,
                         int y)
Processes MOUSE_UP events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_UP event. These events occur when the mouse button is released while inside this component. If the mouse was pressed inside the button then an event is posted.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseUp in class Component
See Also:
mouseDown, handleEvent

All Packages  Class Hierarchy  This Package  Previous  Next  Index