Class tea.set.ImageButton
All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.ImageButton
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----tea.set.ImageButton
- public class ImageButton
- extends Canvas
ImageButton is a widget that behaves like a regular button. But instead
of displaying a text label, it displays an image inside the button. An
ImageButton can be simply constructed by supplying a plain image. A 3D
button image will automatically generated. The default size of the
button is the size of the image. If the button is resized to a size
other than the image size, the image is scaled to the new button
size.
An optional label can be specified for the button. If a label is
specified, it will be show together with the image.
-
BOTTOM
- BOTTOM specifies the label of the button being placed at the bottom
of the button.
-
LEFT
- LEFT specifies the label of the button being placed at the left
of the button.
-
RIGHT
- RIGHT specifies the label of the button being placed at the right
of the button.
-
TOP
- TOP specifies the label of the button being placed at the top
of the button.
-
ImageButton(Image)
- Contruct an ImageButton with the supplied image.
-
ImageButton(Image, String)
- Construct an ImageButton with image and a label.
-
ImageButton(Image, String, int)
- Construct an ImageButton with image and a label.
-
action(Event, Object)
- Action routine caused by a mouse click.
-
disable()
- Disable the button.
-
enable()
- Enable the button.
-
getLabel()
- Return the label of the button, null if none.
-
minimumSize()
- Return the minimum size of the button.
-
mouseDown(Event, int, int)
- Mouse down event causes a pressed button image to be shown.
-
mouseExit(Event, int, int)
- Mouse exit event causes a button to change back to normal state.
-
mouseUp(Event, int, int)
- Mouse up event generates an action event.
-
paint(Graphics)
- Paint button.
-
preferredSize()
- Return the preferred size of the button.
-
reshape(int, int, int, int)
- Reshape the button.
-
resize(Dimension)
- Change the size of the button to dimension.
-
resize(int, int)
- Change the size of the button to (w, h).
-
setImage(Image)
- Set or change the image displayed by this button.
-
setLabel(String)
- Set the label for this button.
-
setLabel(String, int)
- Set the label for this button.
-
setLabelPos(int)
- Set the label position.
TOP
public final static int TOP
- TOP specifies the label of the button being placed at the top
of the button.
LEFT
public final static int LEFT
- LEFT specifies the label of the button being placed at the left
of the button.
BOTTOM
public final static int BOTTOM
- BOTTOM specifies the label of the button being placed at the bottom
of the button.
RIGHT
public final static int RIGHT
- RIGHT specifies the label of the button being placed at the right
of the button.
ImageButton
public ImageButton(Image iv)
- Contruct an ImageButton with the supplied image.
- Parameters:
- iv - button image.
ImageButton
public ImageButton(Image iv,
String label)
- Construct an ImageButton with image and a label.
The default label position is below the image.
- Parameters:
- iv - button image.
- label - button label.
ImageButton
public ImageButton(Image iv,
String label,
int pos)
- Construct an ImageButton with image and a label.
A position for the label can be specified.
- Parameters:
- iv - button image.
- label - button label.
- pos - label position flag.
setLabel
public void setLabel(String label,
int pos)
- Set the label for this button. If there was no label, the apperance
of the button is going to change. The size of the button may also
change depending of the label and image.
- Parameters:
- label - button label.
- pos - label position flag.
setLabel
public void setLabel(String label)
- Set the label for this button. If there was no label, the apperance
of the button is going to change. The size of the button may also
change depending of the label and image.
- Parameters:
- label - button label.
getLabel
public String getLabel()
- Return the label of the button, null if none.
- Returns:
- button label.
setLabelPos
public void setLabelPos(int pos)
- Set the label position.
- Parameters:
- pos - label position flag.
enable
public void enable()
- Enable the button.
- Overrides:
- enable in class Component
disable
public void disable()
- Disable the button. When a button is disabled, no action is
generated when users click inside the button.
- Overrides:
- disable in class Component
resize
public void resize(int w,
int h)
- Change the size of the button to (w, h).
- Parameters:
- w - button width.
- h - button height.
- Overrides:
- resize in class Component
resize
public void resize(Dimension s)
- Change the size of the button to dimension.
- Parameters:
- s - button dimension.
- Overrides:
- resize in class Component
reshape
public void reshape(int x,
int y,
int w,
int h)
- Reshape the button.
- Parameters:
- x - x coordinate.
- y - y coordinate.
- w - button width.
- h - button height.
- Overrides:
- reshape in class Component
action
public boolean action(Event e,
Object w)
- Action routine caused by a mouse click. Argument object is a
reference to ImageButton itself.
- Parameters:
- e - event object.
- w - event argument object.
- Overrides:
- action in class Component
minimumSize
public Dimension minimumSize()
- Return the minimum size of the button.
- Returns:
- minimum size.
- Overrides:
- minimumSize in class Component
preferredSize
public Dimension preferredSize()
- Return the preferred size of the button.
- Returns:
- preferred size.
- Overrides:
- preferredSize in class Component
setImage
public synchronized void setImage(Image iv)
- Set or change the image displayed by this button.
- Parameters:
- iv - button image.
paint
public void paint(Graphics g)
- Paint button.
- Parameters:
- g - Graphics context of this component.
- Overrides:
- paint in class Canvas
mouseDown
public boolean mouseDown(Event e,
int x,
int y)
- Mouse down event causes a pressed button image to be shown.
- Parameters:
- e - event object.
- x - x coordinate of mouse click.
- y - y coordinate of mouse click.
- Overrides:
- mouseDown in class Component
mouseExit
public boolean mouseExit(Event e,
int x,
int y)
- Mouse exit event causes a button to change back to normal state.
- Parameters:
- e - event object.
- x - x coordinate of mouse click.
- y - y coordinate of mouse click.
- Overrides:
- mouseExit in class Component
mouseUp
public boolean mouseUp(Event e,
int x,
int y)
- Mouse up event generates an action event.
- Parameters:
- e - event object.
- x - x coordinate of mouse click.
- y - y coordinate of mouse click.
- Overrides:
- mouseUp in class Component
All Packages Class Hierarchy This Package Previous Next Index