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:
- ╖ Display an image in a button instead of text.
- ╖ Generate a train of action events while the user presses the button.
-
scale
- If true the image is scaled to fit the button.
-
ImageButton()
- Constructs a new default ImageButton.
-
getCenterMode()
- Gets the current image centering mode.
-
getImageURL()
- Returns the URL of the image being displayed in the button.
-
getScaleMode()
- Gets the current image scaling mode.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
setCenterMode(boolean)
- Conditionally sets the image centering mode.
-
setImageURL(URL)
- Sets the URL of the image to display in the button.
-
setScaleMode(boolean)
- Conditionally sets the image scaling mode.
-
update(Graphics)
- Handles redrawing of this component on the screen.
scale
protected boolean scale
- If true the image is scaled to fit the button.
ImageButton
public ImageButton()
- Constructs a new default ImageButton. Image scaling is off and center mode on.
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
getImageURL
public URL getImageURL()
- Returns the URL of the image being displayed in the button.
- See Also:
- setImageURL
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
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
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
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
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
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