ToolBar Class

ToolBar Class

This Package | All Packages

Component
  |
  +--Control
    |
    +--ToolBar
public class ToolBar
extends Control

This class wraps the comctl32 toolbar control.

Constructors
Name Description
ToolBar() Creates a Toolbar control.

Methods
Name Description
addButton(ToolBarButton button) Adds a button to the toolbar.
addOnButtonClick( ToolBarButtonClickEventHandler value) Adds an event handler for when a toolbar button is clicked.
customize() Brings up the customize dialog box for toolbars.
getAllowCustomize() Retrieves the state of the AllowCustomize property.
getAppearance() Retrieves the state of the Appearance property.
getBorderStyle() Retrieves the state of the BorderStyle property.
getButtons() Retrieves an array containing the toolbar buttons.
getButtonSize() Retrieves the state of the ButtonSize property.
getDisabledImageList() Retrieves the DisabledImageList property.
getDivider() Retrieves the Divider property.
getDropDownArrows() Retrieves the DropDownArrows property.
getHotImageList() Retrieves the HotImageList property.
getImageList() Retrieves the ImageList property.
getImageSize() Retrieves the size of the images within the toolbar's image list.
getRightText() Retrieves the RightText property.
getShowTips() Retrieves the state of the ShowTips property.
getStandardImages() Retrieves the StandardImages property.
getToolBarButton(int index) Retrieves a ToolBarButton at a specified index.
getWrappable() Retrieves the state of the Wrappable property.
insertButton(int index, ToolBarButton button) Inserts a button onto the toolbar.
onButtonClick(ToolBarButtonClickEvent e) Event fired when a toolbar button is clicked.
removeAllButtons() Removes all the buttons in the toolbar.
removeButton(int index) Removes a button at the specified index.
removeOnButtonClick( ToolBarButtonClickEventHandler value) Removes an event handler for the ButtonClick event.
setAllowCustomize(boolean customize) Sets the state of the AllowCustomize property.
setAppearance(int appear) Sets the state of the Appearance property.
setBorderStyle(int style) Sets the state of the BorderStyle property.
setButton(int index, ToolBarButton button) Sets a ToolBarButton at the specified index.
setButtons(ToolBarButton[] array) Sets all the buttons within the toolbar.
setButtonSize(Point size) Sets the state of the ButtonSize property.
setDisabledImageList(ImageList value) Sets the DisabledImageList property.
setDivider(boolean value) Sets the Divider property.
setDropDownArrows(boolean value) Sets the DropDownArrows property.
setFont(Font font) Sets the Font property.
setHotImageList(ImageList value) Sets the HotImageList property.
setImageList(ImageList value) Sets the ImageList property.
setRightText(boolean value) Sets the RightText property.
setShowTips(boolean show) Sets the state of the ShowTips property.
setStandardImages(boolean value) Sets the built-in button images.
setWrappable(boolean wrap) Sets the state of the Wrappable property.

Constructors

ToolBar.ToolBar

Syntax
public ToolBar();
Description

Creates a Toolbar control.

Methods

ToolBar.addButton

Syntax
public int addButton( ToolBarButton button );
Parameters
button
The button to add to the toolbar.
Return Value

Returns the button added.

Description

Adds a button to the toolbar.

ToolBar.addOnButtonClick

Syntax
public void addOnButtonClick( ToolBarButtonClickEventHandler value );
Parameters
value
The event handler to add.
Description

Adds an event handler for when a toolbar button is clicked.

ToolBar.customize

Syntax
public void customize();
Description

Brings up the customize dialog box for toolbars.

ToolBar.getAllowCustomize

Syntax
public boolean getAllowCustomize();
Return Value

Returns the state of the AllowCustomize property.

Description

Retrieves the state of the AllowCustomize property. The AllowCustomize property enables the user to customize the toolbar.

ToolBar.getAppearance

Syntax
public int getAppearance();
Return Value

Returns the value of the Appearance property.

Description

Retrieves the state of the Appearance property. The Appearance property determines whether the toolbar appears three-dimensional, flat, or transparent.

ToolBar.getBorderStyle

Syntax
public int getBorderStyle();
Return Value

Returns the value of the BorderStyle property.

Description

Retrieves the state of the BorderStyle property. The BorderStyle property determines whether the toolbar has a border.

ToolBar.getButtons

Syntax
public ToolBarButton[] getButtons();
Return Value

Returns an array of ToolBarButton objects.

Description

Retrieves an array containing the toolbar buttons.

ToolBar.getButtonSize

Syntax
public Point getButtonSize();
Return Value

Returns the size of the buttons on the toolbar.

Description

Retrieves the state of the ButtonSize property. The ButtonSize property determines the size of the buttons on the toolbar.

ToolBar.getDisabledImageList

Syntax
public ImageList getDisabledImageList();
Return Value

Returns an imageList which represents the disabled images.

Description

Retrieves the DisabledImageList property.

ToolBar.getDivider

Syntax
public boolean getDivider();
Return Value

Returns the value of the property.

Description

Retrieves the Divider property. This will display a divider between the toolbar and the menu.

ToolBar.getDropDownArrows

Syntax
public boolean getDropDownArrows();
Return Value

Returns the boolean value.

Description

Retrieves the DropDownArrows property.

ToolBar.getHotImageList

Syntax
public ImageList getHotImageList();
Return Value

Returns an imageList which represents the hot images.

Description

Retrieves the HotImageList property.

ToolBar.getImageList

Syntax
public ImageList getImageList();
Return Value

Returns an imageList which represents the images.

Description

Retrieves the ImageList property.

ToolBar.getImageSize

Syntax
public Point getImageSize();
Return Value

Returns the size of the images in the toolbar.

Description

Retrieves the size of the images within the toolbar's image list.

ToolBar.getRightText

Syntax
public boolean getRightText();
Return Value

Returns the boolean value.

Description

Retrieves the RightText property. This property determines whether the button text is to the right of the image.

ToolBar.getShowTips

Syntax
public boolean getShowTips();
Return Value

Returns the value of the ShowTips property.

Description

Retrieves the state of the ShowTips property. The ShowTips property determines whether the tooltips show on a toolbar button.

ToolBar.getStandardImages

Syntax
public boolean getStandardImages();
Return Value

Returns the state.

Description

Retrieves the StandardImages property.

ToolBar.getToolBarButton

Syntax
public ToolBarButton getToolBarButton( int index );
Parameters
index
The index of the ToolBarButton to return.
Return Value

Returns the ToolBarButton at the specified index.

Description

Retrieves a ToolBarButton at a specified index.

Exceptions

ArrayIndexOutOfBounds thrown if the index is invalid.

ToolBar.getWrappable

Syntax
public boolean getWrappable();
Return Value

Returns the state of the Wrappable property.

Description

Retrieves the state of the Wrappable property. The Wrappable property enables buttons to be wrapped on the toolbar.

ToolBar.insertButton

Syntax
public int insertButton( int index, ToolBarButton button );
Parameters
index
The index at which to insert the button.
button
The button to add to the toolbar.
Return Value

Returns the index of the button added.

Description

Inserts a button onto the toolbar.

Exceptions

ArrayIndexOfOutBoundsException thrown if the index is invalid.

ToolBar.onButtonClick

Syntax
protected void onButtonClick( ToolBarButtonClickEvent e );
Description

Event fired when a toolbar button is clicked. param e The event data, including the ToolBarButton clicked.

ToolBar.removeAllButtons

Syntax
public void removeAllButtons();
Description

Removes all the buttons in the toolbar.

ToolBar.removeButton

Syntax
public void removeButton( int index );
Parameters
index
The index of the button to remove.
Description

Removes a button at the specified index.

Exceptions

ArrayIndexOutOfBoundsException thrown if the index is out of range.

ToolBar.removeOnButtonClick

Syntax
public void removeOnButtonClick( ToolBarButtonClickEventHandler value );
Parameters
value
The event handler to remove.
Description

Removes an event handler for the ButtonClick event.

ToolBar.setAllowCustomize

Syntax
public void setAllowCustomize( boolean customize );
Parameters
customize
The new state of the AllowCustomize property.
Description

Sets the state of the AllowCustomize property. The AllowCustomize property enables the user to customize the toolbar.

ToolBar.setAppearance

Syntax
public void setAppearance( int appear );
Parameters
appear
The new value of the Appearance property.
Description

Sets the state of the Appearance property. The Appearance property determines whether the toolbar appears three-dimensional, flat, or transparent.

ToolBar.setBorderStyle

Syntax
public void setBorderStyle( int style );
Parameters
style
The new value of the BorderStyle property.
Description

Sets the state of the BorderStyle property. The BorderStyle property determines whether the toolbar has a border.

ToolBar.setButton

Syntax
public void setButton( int index, ToolBarButton button );
Parameters
index
The index at which to set the button.
button
The button to set at the index.
Description

Sets a ToolBarButton at the specified index.

ToolBar.setButtons

Syntax
public void setButtons( ToolBarButton[] array );
Parameters
array
The new buttons to add.
Description

Sets all the buttons within the toolbar. The previous buttons will be disowned.

ToolBar.setButtonSize

Syntax
public void setButtonSize( Point size );
Parameters
size
The new size of the buttons on the toolbar.
Description

Sets the state of the ButtonSize property. The ButtonSize property determines the size of the buttons on the toolbar.

ToolBar.setDisabledImageList

Syntax
public void setDisabledImageList( ImageList value );
Parameters
value
The new ImageList.
Description

Sets the DisabledImageList property. These images are used to display images on toolbar buttons when the buttons are disabled.

ToolBar.setDivider

Syntax
public void setDivider( boolean value );
Parameters
value
The new value of the property.
Description

Sets the Divider property. This will display a divider between the toolbar and the menu.

ToolBar.setDropDownArrows

Syntax
public void setDropDownArrows( boolean value );
Parameters
value
The new boolean value of the DropDownArrows property.
Description

Sets the DropDownArrows property.

ToolBar.setFont

Syntax
public void setFont( Font font );
Parameters
font
The new font.
Description

Sets the Font property. Overrides Control.setFont so the toolbar can adjust its size if appropriate.

Overrides

setFont(Font) in Control.

ToolBar.setHotImageList

Syntax
public void setHotImageList( ImageList value );
Parameters
value
The new ImageList.
Description

Sets the HotImageList property. These images are used to display images on toolbar buttons when the mouse is over the button.

ToolBar.setImageList

Syntax
public void setImageList( ImageList value );
Parameters
value
The new ImageList.
Description

Sets the ImageList property. These images are used to display images on toolbar buttons.

ToolBar.setRightText

Syntax
public void setRightText( boolean value );
Parameters
value
The new RightText.
Description

Sets the RightText property. This property determines whether the button text is to the right of the image.

ToolBar.setShowTips

Syntax
public void setShowTips( boolean show );
Parameters
show
The new value of the ShowTips property.
Description

Sets the state of the ShowTips property. The ShowTips property determines whether the tooltips show on a toolbar button.

ToolBar.setStandardImages

Syntax
public void setStandardImages( boolean value );
Parameters
value
Set to true to use standard images; otherwise, set to false.
Description

Sets the built-in button images.

ToolBar.setWrappable

Syntax
public void setWrappable( boolean wrap );
Parameters
wrap
The state of the Wrappable property.
Description

Sets the state of the Wrappable property. The Wrappable property enables buttons to be wrapped on the toolbar.