All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.jmf.MultiPlayer.ImageButton
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----com.ibm.jmf.MultiPlayer.ImageLabel
|
+----com.ibm.jmf.MultiPlayer.ImageButton
- public class ImageButton
- extends ImageLabel
A button class that uses an image instead of a
textual label. Clicking and releasing the mouse over
the button triggers an ACTION_EVENT, so you can add
behavior in the same two ways as you with a normal
Button (in Java 1.0):
- Make an ImageButton subclass and put the
behavior in the action method of that subclass.
- Use the main ImageButton class but then catch
the events in the action method of the Container.
Normally, the ImageButton's preferredSize (used,
for instance, by FlowLayout) is just big enough
to hold the image. However, if you give an explicit
resize or reshape call before adding the
ImageButton to the Container, this size will
override the defaults.
- See Also:
- Icon, GrayFilter
-
actionCommand
-
-
actionListener
-
-
defaultBorderColor
- Default color of 3D border around image.
-
defaultBorderWidth
- Default width of 3D border around image.
-
mouseListener
-
-
mouseMotionListener
-
-
ImageButton()
- Create an ImageButton with the default image.
-
ImageButton(Image)
- Create an ImageButton using the image specified.
-
ImageButton(String)
- Create an ImageButton using the image at URL
specified by the string.
-
ImageButton(String, boolean)
- Create an ImageButton with the default image.
-
ImageButton(URL)
- Create an ImageButton using the image at URL
specified.
-
ImageButton(URL, String)
- Creates an ImageButton using the file in
the directory specified.
-
addActionListener(ActionListener)
- Adds the specified action listener to receive action events from
this button.
-
drawBorder(boolean)
-
-
getActionCommand()
- Returns the command name of the action event fired by this button.
-
getDarkness()
- The darkness value to use for grayed images.
-
getGrayImage()
- The gray image used when button is down.
-
paint(Graphics)
- Draws the image.
-
processActionEvent(ActionEvent)
-
Processes action events occurring on this button
by dispatching them to any registered
ActionListener
objects.
-
processEvent(AWTEvent)
- Processes events on this button.
-
processMouseEvent(MouseEvent)
- Processes mouse event released
-
removeActionListener(ActionListener)
- Removes the specified action listener so that it no longer
receives action events from this button.
-
setActionCommand(String)
- Sets the command name for the action event fired
by this button.
-
setDarkness(int)
- An int whose bits are combined via "and" ("&")
with the alpha, red, green, and blue bits of the
pixels of the image to produce the grayed-out
image to use when button is depressed.
-
setGrayImage(Image)
- Sets gray image created automatically from regular
image via an image filter to use when button is
depressed.
-
setText(String)
-
-
waitForImage(boolean)
- waitForImage needs to check if this is a text button,
else call super.
defaultBorderWidth
protected static final int defaultBorderWidth
- Default width of 3D border around image.
Currently 4.
- See Also:
- setBorder, getBorder
defaultBorderColor
protected static final Color defaultBorderColor
- Default color of 3D border around image.
Currently a gray with R/G/B of 160/160/160.
Light grays look best.
- See Also:
- setBorderColor, getBorderColor
actionCommand
String actionCommand
actionListener
transient ActionListener actionListener
mouseListener
transient MouseListener mouseListener
mouseMotionListener
transient MouseMotionListener mouseMotionListener
ImageButton
public ImageButton()
- Create an ImageButton with the default image.
- See Also:
- getDefaultImageString
ImageButton
public ImageButton(String text,
boolean txt)
- Create an ImageButton with the default image.
- See Also:
- getDefaultImageString
ImageButton
public ImageButton(String imageURLString)
- Create an ImageButton using the image at URL
specified by the string.
- Parameters:
- imageURLString - A String specifying the URL
of the image.
ImageButton
public ImageButton(URL imageURL)
- Create an ImageButton using the image at URL
specified.
- Parameters:
- imageURL - The URL of the image.
ImageButton
public ImageButton(URL imageDirectory,
String imageFile)
- Creates an ImageButton using the file in
the directory specified.
- Parameters:
- imageDirectory - The URL of a directory
- imageFile - File in the above directory
ImageButton
public ImageButton(Image image)
- Create an ImageButton using the image specified.
You would only want to use this if you already
have an image (e.g. created via createImage).
- Parameters:
- image - The image.
waitForImage
public void waitForImage(boolean doLayout)
- waitForImage needs to check if this is a text button,
else call super.
- Overrides:
- waitForImage in class ImageLabel
paint
public void paint(Graphics g)
- Draws the image. If you override this in a
subclass, be sure to call super.paint.
- Overrides:
- paint in class ImageLabel
setActionCommand
public void setActionCommand(String command)
- Sets the command name for the action event fired
by this button. By default this action command is
set to match the label of the button.
- Parameters:
- command - A string used to set the button's
action command.
- See Also:
- ActionEvent
getActionCommand
public String getActionCommand()
- Returns the command name of the action event fired by this button.
addActionListener
public synchronized void addActionListener(ActionListener l)
- Adds the specified action listener to receive action events from
this button. Action events occur when a user presses or releases
the mouse over this button.
- Parameters:
- l - the action listener.
- See Also:
- ActionListener, removeActionListener
removeActionListener
public synchronized void removeActionListener(ActionListener l)
- Removes the specified action listener so that it no longer
receives action events from this button. Action events occur
when a user presses or releases the mouse over this button.
- Parameters:
- l - the action listener.
- See Also:
- ActionListener, addActionListener
processEvent
protected void processEvent(AWTEvent e)
- Processes events on this button. If an event is
an instance of
ActionEvent
, this method invokes
the processActionEvent
method. Otherwise,
it invokes processEvent
on the superclass.
- Parameters:
- e - the event.
- Overrides:
- processEvent in class Component
- See Also:
- ActionEvent, processActionEvent
processMouseEvent
protected void processMouseEvent(MouseEvent e)
- Processes mouse event released
- Overrides:
- processMouseEvent in class Component
processActionEvent
protected void processActionEvent(ActionEvent e)
- Processes action events occurring on this button
by dispatching them to any registered
ActionListener
objects.
This method is not called unless action events are
enabled for this button. Action events are enabled
when one of the following occurs:
- An
ActionListener
object is registered
via addActionListener
.
- Action events are enabled via
enableEvents
.
- Parameters:
- e - the action event.
- See Also:
- ActionListener, addActionListener, enableEvents
setText
protected void setText(String t)
getDarkness
public int getDarkness()
- The darkness value to use for grayed images.
- See Also:
- setDarkness
setDarkness
public void setDarkness(int darkness)
- An int whose bits are combined via "and" ("&")
with the alpha, red, green, and blue bits of the
pixels of the image to produce the grayed-out
image to use when button is depressed.
Default is 0xffafafaf: af combines with r/g/b
to darken image.
getGrayImage
public Image getGrayImage()
- The gray image used when button is down.
- See Also:
- setGrayImage
setGrayImage
public void setGrayImage(Image grayImage)
- Sets gray image created automatically from regular
image via an image filter to use when button is
depressed. You won't normally use this directly.
drawBorder
public void drawBorder(boolean isUp)
All Packages Class Hierarchy This Package Previous Next Index