All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dtai.gwt.ButtonGadget

java.lang.Object
   |
   +----dtai.gwt.Gadget
           |
           +----dtai.gwt.ContainerGadget
                   |
                   +----dtai.gwt.PanelGadget
                           |
                           +----dtai.gwt.BorderGadget
                                   |
                                   +----dtai.gwt.ClickableGadget
                                           |
                                           +----dtai.gwt.ButtonGadget

public class ButtonGadget
extends ClickableGadget
A class that produces a labeled button component.


Variable Index

 o image
 o label

Constructor Index

 o ButtonGadget()
Constructs a Button with no label.
 o ButtonGadget(Image)
Constructs a Button with an unarmedImage.
 o ButtonGadget(Image, Image, Image, Image)
Constructs a Button with an unarmedImage, an armedImage, an overImage, and a disabledImage.
 o ButtonGadget(String)
Constructs a Button with a label.
 o ButtonGadget(String, Image)
Constructs a Button with a label and an image.
 o ButtonGadget(String, Image, Image, Image, Image)
Constructs a Button with a label, an unarmedImage, an armedImage, an overImage, and a disabledImage.

Method Index

 o addActionListener(ActionListener)
Adds the specified listener to be notified when component events occur on this component.
 o click(AWTEvent)
Processes events on this button
 o doDefaultAction(AWTEvent)
Calls click.
 o getArmedImage()
Gets the armedImage variable.
 o getBlackToForeground()
Gets the blacktoForeground value.
 o getDisabledImage()
Gets the disabledImage variable.
 o getLabel()
Gets the label of the Button.
 o getOverImage()
Gets the overImage variable.
 o getUnarmedImage()
Gets the UnarmedImage variable.
 o processActionEvent(ActionEvent)
 o processEvent(AWTEvent)
processEvent
 o processFocusEvent(FocusEvent)
The shell's NormalDefaultGadget repaints (if there is one) and the parent's handleFocusGained method is called.
 o removeActionListener(ActionListener)
Removes the specified listener so it no longer receives action events on this action.
 o setArmedImage(Image)
Sets the armedImage variable.
 o setBlackToForeground(boolean)
Set this to true if you want the black pixels to be converted to the current foreground color.
 o setDisabledImage(Image)
Sets the disabledImage variable.
 o setFocusAllowed(boolean)
Sets the value of the parent's FocusAllowed variable to the supplied value.
 o setImage(Image)
Sets image to the supplied value.
 o setLabel(String)
Sets the button with the specified label.
 o setMouseState(int)
Parent's mouse state is set with the given value, and if the parameter is ARMED or OVER the appropriate Image is set, and for any other non-null state, the unarmedImage is set.
 o setOverImage(Image)
Sets the overImage variable.
 o setUnarmedImage(Image)
Sets the unarmedImage variable.
 o toString()
Returns the name of this Button, if it has one, else "Unmamed Button."

Variables

 o label
 protected LabelGadget label
 o image
 protected ImageGadget image

Constructors

 o ButtonGadget
 public ButtonGadget()
Constructs a Button with no label.

 o ButtonGadget
 public ButtonGadget(String label)
Constructs a Button with a label.

Parameters:
label - label must be a String
 o ButtonGadget
 public ButtonGadget(Image unarmedImage)
Constructs a Button with an unarmedImage.

Parameters:
unarmedImage - the unarmedImage for the Button
 o ButtonGadget
 public ButtonGadget(Image unarmedImage,
                     Image armedImage,
                     Image overImage,
                     Image disabledImage)
Constructs a Button with an unarmedImage, an armedImage, an overImage, and a disabledImage.

Parameters:
unarmedImage - the unarmedImage for the Button, null if not set
armedImage - the armedImage for the Button, null if not set
overImage - the overImage for the Button, null if not set
disabledImage - the disabledImage for the Button, null if not set
 o ButtonGadget
 public ButtonGadget(String label,
                     Image image)
Constructs a Button with a label and an image.

Parameters:
label - the String label for the Button
image - the image for the Button
 o ButtonGadget
 public ButtonGadget(String label,
                     Image unarmedImage,
                     Image armedImage,
                     Image overImage,
                     Image disabledImage)
Constructs a Button with a label, an unarmedImage, an armedImage, an overImage, and a disabledImage.

Parameters:
label - the String label for the Button
unarmedImage - the unarmedImage for the Button, null if not set
armedImage - the armedImage for the Button, null if not set
overImage - the overImage for the Button, null if not set
disabledImage - the disabledImage for the Button, null if not set

Methods

 o toString
 public String toString()
Returns the name of this Button, if it has one, else "Unmamed Button."

Returns:
the name of this Button
Overrides:
toString in class Object
 o setFocusAllowed
 public void setFocusAllowed(boolean focusAllowed)
Sets the value of the parent's FocusAllowed variable to the supplied value. If the given parameter is false, default values are set for FocusThickness(0), DefaultThickness(0), margins(1) and the margins of the ArmedBorder(2,2,0,0).

Parameters:
focusAllowed - new value for parent's focusAllowed.
Overrides:
setFocusAllowed in class ClickableGadget
 o doDefaultAction
 public void doDefaultAction(AWTEvent e)
Calls click.

Parameters:
e - an AWTEvent fed to method click
Overrides:
doDefaultAction in class Gadget
See Also:
click
 o getLabel
 public String getLabel()
Gets the label of the Button.

Returns:
String
See Also:
setLabel
 o setLabel
 public void setLabel(String label)
Sets the button with the specified label.

Parameters:
label - the label to set the button with
See Also:
getLabel
 o getUnarmedImage
 public Image getUnarmedImage()
Gets the UnarmedImage variable.

Returns:
Image - the UnarmedImage variable
 o getArmedImage
 public Image getArmedImage()
Gets the armedImage variable.

Returns:
Image - the armedImage variable
 o getOverImage
 public Image getOverImage()
Gets the overImage variable.

Returns:
Image - the overImage variable
 o getDisabledImage
 public Image getDisabledImage()
Gets the disabledImage variable.

Returns:
Image - the disabledImage variable
 o setImage
 public void setImage(Image image)
Sets image to the supplied value. If the given Image parameter is null, this image is set to null, and this label is removed.

Parameters:
image - - new value for image
 o setBlackToForeground
 public void setBlackToForeground(boolean blackToForeground)
Set this to true if you want the black pixels to be converted to the current foreground color.

Parameters:
blackToForeground - convert/not convert
 o getBlackToForeground
 public boolean getBlackToForeground()
Gets the blacktoForeground value.

Returns:
boolean - the blacktoForeground value
 o setUnarmedImage
 public void setUnarmedImage(Image unarmedImage)
Sets the unarmedImage variable.

Parameters:
unarmedImage - - new Image for unarmedImage
 o setArmedImage
 public void setArmedImage(Image armedImage)
Sets the armedImage variable.

Parameters:
armedImage - - new Image for armedImage
 o setOverImage
 public void setOverImage(Image overImage)
Sets the overImage variable.

Parameters:
overImage - - new Image for overImage
 o setDisabledImage
 public void setDisabledImage(Image disabledImage)
Sets the disabledImage variable.

Parameters:
disabledImage - new Image for disabledImage
 o setMouseState
 public void setMouseState(int state)
Parent's mouse state is set with the given value, and if the parameter is ARMED or OVER the appropriate Image is set, and for any other non-null state, the unarmedImage is set.

Parameters:
state - new mouse state
Overrides:
setMouseState in class ClickableGadget
 o addActionListener
 public synchronized void addActionListener(ActionListener l)
Adds the specified listener to be notified when component events occur on this component.

Parameters:
l - the listener to receive the events
 o removeActionListener
 public synchronized void removeActionListener(ActionListener l)
Removes the specified listener so it no longer receives action events on this action.

Parameters:
l - the listener to remove
 o processEvent
 protected void processEvent(AWTEvent e)
processEvent

Parameters:
e - a ActionEvent
Returns:
boolean result
Overrides:
processEvent in class ContainerGadget
 o processActionEvent
 protected void processActionEvent(ActionEvent e)
 o click
 public void click(AWTEvent mouse)
Processes events on this button

Parameters:
mouse - the firing AWTEvent
Overrides:
click in class ClickableGadget
 o processFocusEvent
 protected void processFocusEvent(FocusEvent e)
The shell's NormalDefaultGadget repaints (if there is one) and the parent's handleFocusGained method is called.

Parameters:
e - the firing FocusEvent
Returns:
boolean
Overrides:
processFocusEvent in class ClickableGadget

All Packages  Class Hierarchy  This Package  Previous  Next  Index