All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.awt.bar.IconButton

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----tea.awt.bar.IconButton

public class IconButton
extends Canvas
implements MouseListener

This component is a Button with an image in it. The drawn image may be a gif or a jpeg image. If you use an animated gif image, the icon will be animated. Usually you can use this component in Toolbars, but it's possible to add it in other containers. In a Toolbar the IconButton accesses the Statusbar of the Docker with an explicative message when the mouse enters it.

Version:
1.0 beta - 31 May 1997
Author:
Leonardo Boselli
See Also:
Toolbar

Constructor Index

 o IconButton(Image, Dimension)
Initialized the icon.
 o IconButton(Image, Dimension, String, String, ActionListener, StatusListener)
Initialized the icon.

Method Index

 o addActionListener(ActionListener)
Adds an ActionListener to this IconButton.
 o getActionCommand()
Gets the action command of this IconButton.
 o getComment()
Gets the descriptive message of this IconButton.
 o getMinimumSize()
Returns the minimum dimensions of this IconButton.
 o getStatusListener()
Returns the StatusListener defined for displaying the description of the IconButton.
 o isActive()
Checks if the IconButton is active or not.
 o mouseClicked(MouseEvent)
Implements the corrsponding method of the MouseListener interface.
 o mouseEntered(MouseEvent)
Implements the corrsponding method of the MouseListener interface.
 o mouseExited(MouseEvent)
Implements the corrsponding method of the MouseListener interface.
 o mousePressed(MouseEvent)
Implements the corrsponding method of the MouseListener interface.
 o mouseReleased(MouseEvent)
Implements the corrsponding method of the MouseListener interface.
 o paint(Graphics)
Paints this IconButton.
 o removeActionListener(ActionListener)
Removes an ActionListener from this IconButton.
 o setActionCommand(String)
Sets the action command of this IconButton.
 o setActive(boolean)
Sets the IconButton to an active or inactive state.
 o setComment(String)
Sets the descriptive message of this IconButton.
 o setStatusListener(StatusListener)
Defines the StatusListener for explicative messages.

Constructors

 o IconButton
 public IconButton(Image img,
                   Dimension sz)
Initialized the icon. No actionCommand, comment and StatusListener are added.

Parameters:
img - the image to be displayed.
sz - the size of the image.
 o IconButton
 public IconButton(Image img,
                   Dimension sz,
                   String c,
                   String ac,
                   ActionListener al,
                   StatusListener sl)
Initialized the icon. All significative data is specified.

Parameters:
img - the image to be displayed.
sz - the size of the image.
c - the explicative message to be displayed in the Statusbar.
ac - the actionCommand.
al - the ActionListener of the actionCommand.
ac - the StatusListener of the explicative message.

Methods

 o setStatusListener
 public void setStatusListener(StatusListener sl)
Defines the StatusListener for explicative messages.

Parameters:
sl - the StatusListener
 o getStatusListener
 public StatusListener getStatusListener()
Returns the StatusListener defined for displaying the description of the IconButton.

Returns:
the StatusListener
 o isActive
 public boolean isActive()
Checks if the IconButton is active or not.

Returns:
the status of the IconButton
 o setActive
 public void setActive(boolean e)
Sets the IconButton to an active or inactive state.

Parameters:
e - sets the state to this value.
 o getComment
 public String getComment()
Gets the descriptive message of this IconButton.

Returns:
the descriptive message
 o setComment
 public void setComment(String c)
Sets the descriptive message of this IconButton.

Parameters:
c - the descriptive message
 o setActionCommand
 public void setActionCommand(String ac)
Sets the action command of this IconButton.

Parameters:
ac - the action command
 o getActionCommand
 public String getActionCommand()
Gets the action command of this IconButton.

Returns:
the action command.
 o addActionListener
 public synchronized void addActionListener(ActionListener l)
Adds an ActionListener to this IconButton. ActionListeners may be one or more.

Parameters:
l - the ActionListener.
 o removeActionListener
 public synchronized void removeActionListener(ActionListener l)
Removes an ActionListener from this IconButton.

Parameters:
l - the ActionListener.
 o paint
 public void paint(Graphics g)
Paints this IconButton.

Parameters:
g - the Graphics to be painted.
Overrides:
paint in class Canvas
 o getMinimumSize
 public Dimension getMinimumSize()
Returns the minimum dimensions of this IconButton.

Returns:
the minimun dimensions.
Overrides:
getMinimumSize in class Component
 o mouseClicked
 public void mouseClicked(MouseEvent me)
Implements the corrsponding method of the MouseListener interface.

Parameters:
me - the MouseEvent.
 o mouseEntered
 public void mouseEntered(MouseEvent me)
Implements the corrsponding method of the MouseListener interface.

Parameters:
me - the MouseEvent.
 o mouseExited
 public void mouseExited(MouseEvent me)
Implements the corrsponding method of the MouseListener interface.

Parameters:
me - the MouseEvent.
 o mousePressed
 public void mousePressed(MouseEvent me)
Implements the corrsponding method of the MouseListener interface.

Parameters:
me - the MouseEvent.
 o mouseReleased
 public void mouseReleased(MouseEvent me)
Implements the corrsponding method of the MouseListener interface.

Parameters:
me - the MouseEvent.

All Packages  Class Hierarchy  This Package  Previous  Next  Index