Class como.awt.ImageButton
All Packages Class Hierarchy This Package Previous Next Index
Class como.awt.ImageButton
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----como.awt.ImageButton
- public class ImageButton
- extends Canvas
ImageButton is a button which uses images to represent
the states of the button - normal, pressed.
They don't have to be fully loaded! They will be loaded
asynchronously here!
-
ImageButton(Image, Image, int, int)
- Construct an image button.
-
ImageButton(int, int, String)
-
-
getState()
- Get the current state of the switch! (if it's a button
you will get true if it's currently pressed).
-
gotFocus(Event, Object)
-
-
imageUpdate(Image, int, int, int, int, int)
- Tell me all about the image ;-)
(inspired from Component.java)
-
keyDown(Event, int)
- Move the focus to the next component
Does NOT work! (cause nextFocus() doesn't do what I wanted)
-
lostFocus(Event, Object)
-
-
minimumSize()
- tell my minimum-size
-
mouseDown(Event, int, int)
- handle the MouseDownEvents.
-
mouseUp(Event, int, int)
- handle the MouseUpEvent.
-
paint(Graphics)
- Draws the picture on the screen (if parts are loaded,
then it draws those parts).
-
preferredSize()
- tell my preferred-size
-
sendEvent()
- This delivers the Event to the parent.
-
setImages(Image, Image)
- Here you may change the pictures used in the button.
-
setNoPush(boolean)
- Here you can set, if you want the button to be pushed
down, if someone clicks or not.
-
setState(boolean)
- Set the current state of the switch!
(If it is a button then do nothing!)
-
setSwitch(boolean)
- Make it a Switch instead of a Button.
ImageButton
public ImageButton(Image normal,
Image pressed,
int w,
int h)
- Construct an image button. We have two states:
Normal and pressed. They both must be non-null.
Then you must specify the width and height of the button.
(May be different from the â– icture's size and the picture
will be loaded asynchronously!)
ImageButton
public ImageButton(int w,
int h,
String text)
setImages
public void setImages(Image normal,
Image pressed)
- Here you may change the pictures used in the button.
setSwitch
public void setSwitch(boolean sw)
- Make it a Switch instead of a Button. Now the user can press
the switch and it's on or off then! You will get an action-message
that the state changed. Get state with getState().
setNoPush
public void setNoPush(boolean np)
- Here you can set, if you want the button to be pushed
down, if someone clicks or not.
(Usefull if you just want to display a picture!)
setState
public void setState(boolean onoff)
- Set the current state of the switch!
(If it is a button then do nothing!)
- Parameters:
- onoff - indicating on or off
getState
public boolean getState()
- Get the current state of the switch! (if it's a button
you will get true if it's currently pressed).
- Returns:
- if the switch is on then return true; else false.
keyDown
public boolean keyDown(Event evt,
int key)
- Move the focus to the next component
Does NOT work! (cause nextFocus() doesn't do what I wanted)
- Overrides:
- keyDown in class Component
sendEvent
public void sendEvent()
- This delivers the Event to the parent.
mouseDown
public boolean mouseDown(Event event,
int x,
int y)
- handle the MouseDownEvents.
- Overrides:
- mouseDown in class Component
mouseUp
public boolean mouseUp(Event event,
int x,
int y)
- handle the MouseUpEvent.
- Overrides:
- mouseUp in class Component
paint
public void paint(Graphics graphics)
- Draws the picture on the screen (if parts are loaded,
then it draws those parts).
Overrides paint-Method.
- Overrides:
- paint in class Canvas
preferredSize
public Dimension preferredSize()
- tell my preferred-size
- Overrides:
- preferredSize in class Component
minimumSize
public Dimension minimumSize()
- tell my minimum-size
- Overrides:
- minimumSize in class Component
gotFocus
public boolean gotFocus(Event evt,
Object what)
- Overrides:
- gotFocus in class Component
lostFocus
public boolean lostFocus(Event evt,
Object what)
- Overrides:
- lostFocus in class Component
imageUpdate
public boolean imageUpdate(Image img,
int flags,
int x,
int y,
int w,
int h)
- Tell me all about the image ;-)
(inspired from Component.java)
- Overrides:
- imageUpdate in class Component
All Packages Class Hierarchy This Package Previous Next Index