borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.control 

ButtonBar component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----java.awt.Panel
                           +----borland.jbcl.control.BevelPanel
                                   +----borland.jbcl.control.ButtonBar
                                           +----borland.jbcl.control.NavigatorControl

About the ButtonBar component

Variables  Constructors  Properties  Methods  Event Listeners

Implements BlackBox, MenuContainer, ImageObserver, Serializable

A ButtonBar object is a container for buttons. You add buttons to the ButtonBar using the addImageButton() or addTextButton() methods. The ButtonBar defaults to a horizontal bar with buttons that are spaced four pixels apart. You override these defaults by setting the alignment property to set the display alignment and the addSpace() method to specify a different spacing between buttons.

When a button on the ButtonBar is clicked, an ActionEvent is sent to all registered listeners. The ID associated with the ActionEvent contains the ID of the button that was clicked. When notified of the event, each listener can act on the event, or pass it on to another method for handling.


ButtonBar variables

Variables implemented in this class

Variables implemented in borland.jbcl.control.BevelPanel

Variables implemented in java.awt.Component

ButtonBar constructors

ButtonBar properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.control.BevelPanel

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

ButtonBar methods

Methods implemented in this class

Methods implemented in borland.jbcl.control.BevelPanel

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.awt.Panel

Methods implemented in java.lang.Object

ButtonBar event listeners


ButtonBar variables

IMAGE_ONLY

  public static final int IMAGE_ONLY = 2
A constant used with the buttonType property that specifies image-only buttons.

TEXT_AND_IMAGE

  public static final int TEXT_AND_IMAGE = 3
A constant used with the buttonType property that specifies both text and image buttons.

TEXT_ONLY

  public static final int TEXT_ONLY = 1
A constant used with the buttonType property that specifies text-only buttons.

actionMulticaster

  protected transient ActionMulticaster actionMulticaster

mouseMotionMulticaster

  protected transient MouseMotionMulticaster mouseMotionMulticaster

mouseMulticaster

  protected transient MouseMulticaster mouseMulticaster


ButtonBar constructors

ButtonBar()

  public ButtonBar()
Constructs a ButtonBar component with the default settings of TEXT_AND_IMAGE and HORIZONTAL orientation.

Buttons are added to the ButtonBar from left to right for a horizontal ButtonBar or top down for a vertical ButtonBar.


ButtonBar properties

alignment

 public int getAlignment()
 public void setAlignment(int alignment)
Stores the alignment for this ButtonBar. Accepted values for alignment are defined in Alignment variables.

buttonType

 public int getButtonType()
 public void setButtonType(int buttonType)
Stores the type of the ButtonBar. Accepted values are TEXT_ONLY, IMAGE_ONLY, or TEXT_AND_IMAGE.

hgap

 public int getHgap()
 public void setHgap(int gap)
Returns or sets the horizontal gap setting, in pixels for this ButtonBar.

imageBase

 public String getImageBase()
 public void setImageBase(java.lang.String ib)
Specifies the base location for finding the images specified in the imageNames property. The location can be a Universal Resource Locator (URL), a relative path, or an absolute path prefix.

imageNames

 public String[] getImageNames()
 public void setImageNames(java.lang.String[] imageNames)
Specifies the array of String names for the images displayed on the ButtonBar.

labels

 public String[] getLabels()
 public void setLabels(java.lang.String[] labels)
Specifies the array of String names for the buttons in the ButtonBar. The array represents the buttons to be added (replacing old) to the ButtonBar. These labels also distinguish the added buttons as the ActionCommand in the ActionPerformed method on the ButtonBar.

layout

 public void setLayout(java.awt.LayoutManager layout)
Write-only property that specifies the java.awt.LayoutManager for the ButtonBar.

preferredSize

 public Dimension getPreferredSize()
Stores the preferred dimensions to use when drawing the ButtonBar.

vgap

 public int getVgap()
 public void setVgap(int gap)
Stores the vertical gap setting, in pixels, for this ButtonBar.


ButtonBar methods

addImageButton(java.awt.Image, java.lang.String, java.lang.String)

  protected Component addImageButton(java.awt.Image image, java.lang.String label, java.lang.String command)
Creates a new ImageButton with the properties specified in its parameters and adds it to the ButtonBar.

Parameters:

image
The image on the button.
label
The string label on the button.
command
The actionId associated with this button by which you can later refer to this button.

addSpace()

  protected Component addSpace()
Adds a space 4 pixels wide between each button on the ButtonBar object, repaints the ButtonBar object, and returns the Component object. To specify the amount of space between buttons, use addSpace(int).

addSpace(int)

  protected Component addSpace(int gap)
Adds the specified amount of space (in pixels) between each button then repaints the ButtonBar.

See also: addSpace()

addTextButton(java.lang.String, java.lang.String)

  protected Component addTextButton(java.lang.String label, java.lang.String command)
Adds a button to the ButtonBar that displays a text string specified by label and assigns it the actionId specified by actionId. The actionId is any integer value by which you can later refer to this button and keep track of it. When a button is pressed, the actionEvent occurs, and registered listeners of the ButtonBar are notified. Using the actionId, listeners can determine exactly which button was pressed and what actions should take place.

Parameters:

label
The text that appears on the button.
command
The actionId associated with this button by which you can later refer to this button.

assureImages()

  protected void assureImages()

doLayout()

  public void doLayout()

Overrides: java.awt.Container.doLayout()

invalidateButtons()

  protected void invalidateButtons()

invalidateImages()

  protected void invalidateImages()

rebuild()

  protected void rebuild()

setButtonEnabled(int, boolean)

  public void setButtonEnabled(int index, boolean enabled)
Enables or disables a particular button by index

Parameters:

index
The index of the button to be enabled.
enabled
Whether or not to enable the button.

setButtonEnabled(java.lang.String, boolean)

  public void setButtonEnabled(java.lang.String label, boolean enabled)
Enables or disables a particular button by label.

Parameters:

label
The label of the button to be enabled.
enabled
Whether or not to enable the button.


ButtonBar event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events.

action

 public synchronized void addActionListener(java.awt.event.ActionListener l)
 public synchronized void removeActionListener(java.awt.event.ActionListener l)

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener l)
 public synchronized void removeComponentListener(java.awt.event.ComponentListener l)

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener l)
 public void removeContainerListener(java.awt.event.ContainerListener l)

focus

 public synchronized void addFocusListener(java.awt.event.FocusListener l)
 public synchronized void removeFocusListener(java.awt.event.FocusListener l)

key

 public synchronized void addKeyListener(java.awt.event.KeyListener l)
 public synchronized void removeKeyListener(java.awt.event.KeyListener l)

mouse

 public void addMouseListener(java.awt.event.MouseListener l)
 public void removeMouseListener(java.awt.event.MouseListener l)

mouseMotion

 public void addMouseMotionListener(java.awt.event.MouseMotionListener l)
 public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)