All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.ImageButton

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

public class ImageButton
extends ButtonBase
The ImageButton component is similar to a regular button except that it displays an image on the button's face. The image to use is specified with a URL.

Use an ImageButton to:


Variable Index

 o scale
If true the image is scaled to fit the button.

Constructor Index

 o ImageButton()
Constructs a new default ImageButton.

Method Index

 o getCenterMode()
Gets the current image centering mode.
 o getImageURL()
Returns the URL of the image being displayed in the button.
 o getScaleMode()
Gets the current image scaling mode.
 o paint(Graphics)
Paints this component using the given graphics context.
 o setCenterMode(boolean)
Conditionally sets the image centering mode.
 o setImageURL(URL)
Sets the URL of the image to display in the button.
 o setScaleMode(boolean)
Conditionally sets the image scaling mode.
 o update(Graphics)
Handles redrawing of this component on the screen.

Variables

 o scale
  protected boolean scale
If true the image is scaled to fit the button.

Constructors

 o ImageButton
  public ImageButton()
Constructs a new default ImageButton. Image scaling is off and center mode on.

Methods

 o setImageURL
  public void setImageURL(URL u)
Sets the URL of the image to display in the button.

Parameters:
u - the URL of the image to display
See Also:
getImageURL
 o getImageURL
  public URL getImageURL()
Returns the URL of the image being displayed in the button.

See Also:
setImageURL
 o setScaleMode
  public void setScaleMode(boolean flag)
Conditionally sets the image scaling mode. When this mode is on, the image is scaled to fit within the border of the button.

Parameters:
flag - if true, the image is scaled to fit the button; if false, the image is not scaled
See Also:
getScaleMode
 o getScaleMode
  public boolean getScaleMode()
Gets the current image scaling mode. When this mode is on, the image is scaled to fit within the border of the button.

Returns:
true if the image is scaled to fit the button; otherwise false
See Also:
setScaleMode
 o setCenterMode
  public void setCenterMode(boolean flag)
Conditionally sets the image centering mode. When this mode is on, the image is centered within the button. When it is off, the image is drawn starting in the upper-left corner.

Parameters:
flag - if true, the image is centered on the button; if false, the image is displayed starting in the upper-left corner
See Also:
getCenterMode
 o getCenterMode
  public boolean getCenterMode()
Gets the current image centering mode. When this mode is on, the image is centered within the button. When it is off, the image is drawn starting in the upper-left corner.

Returns:
true if the image is centered on the button; otherwise false
See Also:
setCenterMode
 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.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class ButtonBase
See Also:
repaint, update
 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 ButtonBase
See Also:
repaint, paint

All Packages  Class Hierarchy  This Package  Previous  Next  Index