|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JMenuBar com.jidesoft.action.DockableBar com.jidesoft.action.CommandBar
public class CommandBar
CommandBar
is a special DockableBar which is used to implement components like toolbars and menu bars.
Nested Class Summary | |
---|---|
protected class |
CommandBar.CommandBarContainerListener
|
static class |
CommandBar.Expansion
A filler component that can be added to CommandBar to push components after it to align to the other end. |
Nested classes/interfaces inherited from class javax.swing.JMenuBar |
---|
JMenuBar.AccessibleJMenuBar |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected boolean |
_changingContainer
Flag indicating that a batch of add-component or remove-component operations is taking place; so don't re-validate the window until the flag is reset, indicating that the batch is complete. |
protected CommandBar.CommandBarContainerListener |
_commandBarContainerListener
Listener to re-validate window if components are added to or removed from a floating CommandBar. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface com.jidesoft.swing.Alignable |
---|
PROPERTY_ORIENTATION |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
CommandBar()
Creates a new CommandBar; orientation defaults to HORIZONTAL . |
|
CommandBar(int orientation)
Creates a new CommandBar with the specified orientation . |
|
CommandBar(String key)
Creates a new CommandBar with the specified key . |
|
CommandBar(String key,
String title)
Creates a new CommandBar with the specified key and title. |
|
CommandBar(String key,
String title,
int orientation)
Creates a new CommandBar with a specified key and orientation . |
Method Summary | |
---|---|
JComponent |
add(Action a)
Adds a new JButton which dispatches the action. |
void |
addExpansion()
adds a expansion component. |
protected void |
addImpl(Component comp,
Object constraints,
int index)
Overrides superclass to handle special UIResources when they are added. |
void |
addSeparator()
Appends a separator of default size to the end of the CommandBar. |
void |
addSeparator(Dimension size)
Appends a separator of a specified size to the end of the CommandBar. |
void |
adjustChildrenOrientation(int orientation)
|
protected PropertyChangeListener |
createActionChangeListener(JComponent component)
Returns a properly configured PropertyChangeListener which updates the control as changes to the
Action occur, or null if the default property change listener for the control is
desired. |
protected JComponent |
createActionComponent(Action a)
Factory method which creates the JButton for Action s added to the
CommandBar . |
Component[] |
getHiddenComponents()
Gets an array of all hidden components. |
Insets |
getMargin()
Returns the margin between the CommandBar's border and its buttons. |
JMenu |
getMenu(int index)
Returns the menu at the specified position in the menu bar. |
int |
getMenuCount()
Returns the number of items in the menu bar. |
int |
getPreferredRowCount()
Gets the preferred row count when the CommandBar is in floating mode. |
MenuBarUI |
getUI()
Returns the CommandBar's current UI. |
String |
getUIClassID()
Returns the name of the L&F class that renders this component. |
boolean |
isBorderPainted()
Gets the borderPainted property. |
static boolean |
isScreenMenuBar(JMenuBar jMenuBar)
Checks if the menu bar is used as screen menu bar (on Mac OS X only). |
protected void |
paintBorder(Graphics g)
Paints the CommandBar's border if the borderPainted property is true . |
void |
remove(Component comp)
Overridden to remove the component from the hiddenComponents list if it isn't in the components list. |
void |
removeAll()
Overridden to remove the clear the hiddenComponents list as well as the components list. |
void |
removeAllHiddenComponents()
Removes all components from the hidden components list. |
void |
setBorderPainted(boolean b)
Sets the borderPainted property, which is true if the border should be painted. |
void |
setChangingContainer(boolean newChangingContainer)
Set flag indicating that a batch of add-component or remove-component operations is taking place. |
void |
setMargin(Insets m)
Sets the margin between the CommandBar's border and its buttons. |
void |
setPreferredRowCount(int preferredRowCount)
Sets the preferred row count when the CommandBar is in floating mode. |
void |
updateUI()
Notification from the UIFactory that the L&F has changed. |
void |
validateWindowIfFloating()
|
Methods inherited from class javax.swing.JMenuBar |
---|
add, addNotify, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getHelpMenu, getSelectionModel, getSubElements, isSelected, menuSelectionChanged, paramString, processKeyBinding, processKeyEvent, processMouseEvent, removeNotify, setHelpMenu, setSelected, setSelectionModel, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jidesoft.swing.TopLevelMenuContainer |
---|
isMenuBar |
Field Detail |
---|
protected CommandBar.CommandBarContainerListener _commandBarContainerListener
protected boolean _changingContainer
Constructor Detail |
---|
public CommandBar()
HORIZONTAL
.
public CommandBar(int orientation)
orientation
. The orientation
must be either
HORIZONTAL
or VERTICAL
.
orientation
- the orientation desiredpublic CommandBar(String key)
key
.
key
- the key of the CommandBarpublic CommandBar(String key, String title)
HORIZONTAL
.
key
- the key of the CommandBartitle
- the titlepublic CommandBar(String key, String title, int orientation)
key
and orientation
. All other constructors
call this constructor. If orientation
is an invalid value, an exception will be thrown.
key
- the key of the CommandBartitle
- the title of the CommandBarorientation
- the initial orientation -- it must be either HORIZONTAL
or VERTICAL
Method Detail |
---|
public MenuBarUI getUI()
getUI
in class JMenuBar
JMenuBar.setUI(javax.swing.plaf.MenuBarUI)
public void updateUI()
UIFactory
that the L&F has changed. Called to replace the UI with the latest
version from the UIFactory
.
updateUI
in class JMenuBar
JComponent.updateUI()
public String getUIClassID()
getUIClassID
in class JMenuBar
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public void setMargin(Insets m)
null
causes the
CommandBar to use the default margins. The CommandBar's default Border
object uses this value to
create the proper margin. However, if a non-default border is set on the CommandBar, it is that
Border
object's responsibility to create the appropriate margin space (otherwise this property will
effectively be ignored).
setMargin
in class JMenuBar
m
- an Insets
object that defines the space between the border and the buttonsInsets
public Insets getMargin()
getMargin
in class JMenuBar
Insets
object containing the margin valuesInsets
public boolean isBorderPainted()
borderPainted
property.
isBorderPainted
in class JMenuBar
borderPainted
propertysetBorderPainted(boolean)
public void setBorderPainted(boolean b)
borderPainted
property, which is true
if the border should be painted. The
default value for this property is true
. Some look and feels might not implement painted borders;
they will ignore this property.
setBorderPainted
in class JMenuBar
b
- if true, the border is paintedisBorderPainted()
protected void paintBorder(Graphics g)
borderPainted
property is true
.
paintBorder
in class JMenuBar
g
- the Graphics
context in which the painting is doneJComponent.paint(java.awt.Graphics)
,
JComponent.setBorder(javax.swing.border.Border)
public void setChangingContainer(boolean newChangingContainer)
newChangingContainer
- true to indicate the container is being changed. False to indicate it stops
changing.public void validateWindowIfFloating()
public void addSeparator()
public void addSeparator(Dimension size)
addSeparator()
.
size
- the Dimension
of the separatorpublic JComponent add(Action a)
JButton
which dispatches the action.
As of 1.3, this is no longer the preferred method for adding Action
s to a container. Instead it is
recommended to configure a control with an action using using setAction
, and then add that control
directly to the Container
.
a
- the Action
object to add as a new menu item
protected JComponent createActionComponent(Action a)
JButton
for Action
s added to the
CommandBar
. The default name is empty if a null
action is passed.
As of 1.3, this is no longer the preferred method for adding Action
s to a Container
.
Instead it is recommended to configure a control with an action using setAction
, and then add that
control directly to the Container
.
a
- the Action
for the button to be added
Action
protected PropertyChangeListener createActionChangeListener(JComponent component)
PropertyChangeListener
which updates the control as changes to the
Action
occur, or null
if the default property change listener for the control is
desired.
As of 1.3, this is no longer the preferred method for adding Action
s to a Container
.
Instead it is recommended to configure a control with an action using setAction
, and then add that
control directly to the Container
.
component
- the component
null
protected void addImpl(Component comp, Object constraints, int index)
addImpl
in class DockableBar
comp
- the component to be enhancedconstraints
- the constraints to be enforced on the componentindex
- the index of the componentpublic static boolean isScreenMenuBar(JMenuBar jMenuBar)
jMenuBar
- the JMenuBar
public int getPreferredRowCount()
public void setPreferredRowCount(int preferredRowCount)
preferredRowCount
- the preferred row countpublic Component[] getHiddenComponents()
public void remove(Component comp)
remove
in class Container
comp
- the component to be removedpublic void removeAll()
removeAll
in class Container
public void removeAllHiddenComponents()
public int getMenuCount()
getMenuCount
in class JMenuBar
public JMenu getMenu(int index)
getMenu
in class JMenuBar
index
- an integer giving the position in the menu bar, where 0 is the first position
JMenu
at that position, or null
if if there is no JMenu
at
that position (ie. if it is a JMenuItem
)public void addExpansion()
DockableBar.setStretch(boolean)
public void adjustChildrenOrientation(int orientation)
adjustChildrenOrientation
in class DockableBar
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |