public abstract class ToolBarExtension
extends java.lang.Object
Constructor and Description |
---|
ToolBarExtension(boolean startsWithSeparator)
Creates a new toolbar extension.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addButton(javax.swing.JButton button)
Adds a new button to the extension.
|
protected void |
addSeparator()
Adds a new separator to the extension.
|
void |
apply(javax.swing.JToolBar toolBar)
Applies the extension to the specified toolbar.
|
javax.swing.Icon |
getMenuOptionIcon()
Gets the icon of the menu option.
|
java.lang.String |
getMenuOptionText()
Gets the text of the option that is shown in the menu of the host application.
|
boolean |
getShowInMenu()
Indicates whether the toolbar extension should be shown in the menu of the host application.
|
boolean |
isEnabled()
Indicates whether the toolbar extension is enabled.
|
void |
remove(javax.swing.JToolBar toolBar)
Removes this extension from the specified toolbar.
|
void |
setEnabled(boolean enabled)
Sets whether the toolbar extension is enabled.
|
void |
showMenuOption()
Invokes the option that is shown in the menu of the host application.
|
public ToolBarExtension(boolean startsWithSeparator)
addButton(JButton)
or addSeparator()
to create the extension components.
startsWithSeparator
- true
if the extension should be separated from the other elements in the toolbar otherwise false
public final void apply(javax.swing.JToolBar toolBar)
toolBar
- the toolbarpublic final void remove(javax.swing.JToolBar toolBar)
toolBar
- the toolbar where this extension should be removedprotected final void addButton(javax.swing.JButton button) throws java.lang.IllegalArgumentException
button
- toolbar buttonjava.lang.IllegalArgumentException
- protected final void addSeparator()
public final boolean isEnabled()
true
if the extension is enabled otherwise false
public final void setEnabled(boolean enabled)
enabled
- true
if the extension should be enabled otherwise false
public boolean getShowInMenu()
true
if the extension or one of its options should be shown in the menu otherwise false
getMenuOptionText()
,
showMenuOption()
public java.lang.String getMenuOptionText()
getShowInMenu()
,
showMenuOption()
public javax.swing.Icon getMenuOptionIcon()
null
if there is no iconpublic void showMenuOption()
getShowInMenu()
,
getMenuOptionText()