All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.awt.bar.Toolbar

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----tea.awt.bar.Toolbar

public class Toolbar
extends Panel
implements ActionListener, LanguageSpeaker

This container is a Toolbar. It can contain several components of every kind, but its preferred component is the IconButton. It can also be contained by several containers, but its preferred container is a Docker. A Toolbar with IconButtons in a Docker performs some automatic tasks (e.g. Statusbar interaction). Placement of the Toolbar in the Docker takes place through a Popup Menu.
The Toolbar can also be easily internationalized because implements LanguageSpeaker (internally supported languages are English and Italian).

Version:
1.0 beta - 31 May 1997
Author:
Leonardo Boselli
See Also:
IconButton, LanguageSpeaker

Variable Index

 o HORIZONTAL
The flag for the horizontal placement.
 o VERTICAL
The flag for the vertical placement.

Constructor Index

 o Toolbar()
Constructs the LanguageLearner and the Popup Menu.

Method Index

 o actionPerformed(ActionEvent)
Implements the ActionListener interface and performs the placement of the toolbar delivering the event to the parent Docker.
 o addIcon(Image, Dimension, String, String, ActionListener, StatusListener)
Adds an IconButton to the Toolbar with the specified size.
 o addIcon(Image, String, String, ActionListener, StatusListener)
Adds an IconButton to the Toolbar (icons are squares and the iconSize is used).
 o changeSpokenLanguage(String)
Implements the LanguageSpeaker interface and listens to the changes of the spoken language.
 o getIconSize()
Gets the icon size (used when icons are entered without their own size).
 o getLanguageLearner()
Returns a LanguageLearner for the Toolbar (it's used to learn other languages).
 o getMaximumSize()
Returns the maximum dimensions of this IconButton.
 o getMinimumSize()
Returns the minimum dimensions of the Toolbar.
 o getPreferredSize()
Returns the preferred dimensions of this IconButton.
 o getSpokenLanguages()
Gets the languages spoken by the Toolbar.
 o getStatusListener()
Returns the StatusListener of the inner IconButtons.
 o isMoveable()
Determines if the Toolbar is moveable or not.
 o isMoveable(boolean)
Sets the moveable state of the Toolbar.
 o paint(Graphics)
Paints the Toolbar.
 o processMouseEvent(MouseEvent)
Processes the MouseEvent.
 o setActiveIcon(String, boolean)
Sets the state of the related IconButton.
 o setDocker(Docker)
Defines the Docker of the Toolbar.
 o setIconSize(int)
Sets the icon size (used when icons are entered without their own size).
 o setOrientation(int)
Places the Toolbar in the correct orientation.
 o setStatusListener(StatusListener)
Defines the StatusListener of the inner IconButtons.

Variables

 o HORIZONTAL
 public static final int HORIZONTAL
The flag for the horizontal placement.

 o VERTICAL
 public static final int VERTICAL
The flag for the vertical placement.

Constructors

 o Toolbar
 public Toolbar()
Constructs the LanguageLearner and the Popup Menu.

See Also:
LanguageLearner

Methods

 o setStatusListener
 public void setStatusListener(StatusListener sl)
Defines the StatusListener of the inner IconButtons. The Toolbar has only a StatusListener at a time. It's called automatically if you use setDocker().

Parameters:
sl - the StatusListener.
See Also:
setDocker
 o setDocker
 public void setDocker(Docker d)
Defines the Docker of the Toolbar. It's useful when the Toolbar is owned by a container contained in a Docker: this happens with MultiDocker frames. Otherwise (when the parent of the Toolbar is the Docker) you can ignore it.

Parameters:
d - the Docker.
 o getStatusListener
 public StatusListener getStatusListener()
Returns the StatusListener of the inner IconButtons. The Toolbar has only a StatusListener at a time.

Returns:
the StatusListener.
 o setOrientation
 public void setOrientation(int o)
Places the Toolbar in the correct orientation.

Parameters:
o - the orintation. You must use the defined values.
See Also:
HORIZONTAL, VERTICAL
 o setActiveIcon
 public void setActiveIcon(String action,
                           boolean active)
Sets the state of the related IconButton. The IconButton is selected through its actionCommnad. If the IconButton is inactive it can't send its actionCommand to its ActionListeners.

Parameters:
action - the actionCommand of the selected IconButton.
active - the active or inactive flag.
 o isMoveable
 public boolean isMoveable()
Determines if the Toolbar is moveable or not.

Returns:
the moveable state.
 o isMoveable
 public void isMoveable(boolean m)
Sets the moveable state of the Toolbar.

Parameters:
m - the moveable state.
 o getIconSize
 public int getIconSize()
Gets the icon size (used when icons are entered without their own size).

Returns:
m the size (width and height are the same).
 o setIconSize
 public void setIconSize(int is)
Sets the icon size (used when icons are entered without their own size).

Parameters:
is - the size (width and height are the same).
 o addIcon
 public void addIcon(Image img,
                     String c,
                     String ac,
                     ActionListener al,
                     StatusListener sl)
Adds an IconButton to the Toolbar (icons are squares and the iconSize is used).

Parameters:
img - the image of the icon.
c - the descriptive text.
ac - the action command.
al - the ActionListener.
sl - the StatusListener.
 o addIcon
 public void addIcon(Image img,
                     Dimension sz,
                     String c,
                     String ac,
                     ActionListener al,
                     StatusListener sl)
Adds an IconButton to the Toolbar with the specified size.

Parameters:
img - the image of the icon.
sz - the size of the icon.
c - the descriptive text.
ac - the action command.
al - the ActionListener.
al - the StatusListener.
 o paint
 public void paint(Graphics g)
Paints the Toolbar.

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

Returns:
the minimum dimensions.
Overrides:
getMinimumSize in class Container
 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred dimensions of this IconButton.

Returns:
the preferred dimensions.
Overrides:
getPreferredSize in class Container
 o getMaximumSize
 public Dimension getMaximumSize()
Returns the maximum dimensions of this IconButton.

Returns:
the maximum dimensions.
Overrides:
getMaximumSize in class Container
 o processMouseEvent
 protected void processMouseEvent(MouseEvent me)
Processes the MouseEvent.

Parameters:
me - the MouseEvent.
Overrides:
processMouseEvent in class Component
 o actionPerformed
 public void actionPerformed(ActionEvent ae)
Implements the ActionListener interface and performs the placement of the toolbar delivering the event to the parent Docker.

Parameters:
ae - the ActionEvent.
 o changeSpokenLanguage
 public boolean changeSpokenLanguage(String l)
Implements the LanguageSpeaker interface and listens to the changes of the spoken language.

Parameters:
l - the spoken language.
Returns:
if the language is supported or not.
 o getSpokenLanguages
 public Enumeration getSpokenLanguages()
Gets the languages spoken by the Toolbar.

Returns:
languages spoken.
 o getLanguageLearner
 public LanguageLearner getLanguageLearner()
Returns a LanguageLearner for the Toolbar (it's used to learn other languages).

Returns:
the LanguageLearner.

All Packages  Class Hierarchy  This Package  Previous  Next  Index