|
|||||||||||
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
Safe:
Field Summary | |
private static boolean |
DEBUG
|
private Insets |
margin
|
private boolean |
paintBorder
|
private SingleSelectionModel |
selectionModel
|
private static boolean |
TRACE
|
private static String |
uiClassID
|
private static boolean |
VERBOSE
|
Fields inherited from class javax.swing.JComponent |
_bounds, accessibleContext, listenerList, paintingChild, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Constructor Summary | |
JMenuBar()
Enabled: Creates a new menu bar. |
Method Summary | |
JMenu |
add(JMenu c)
Enabled: Appends the specified menu to the end of the menu bar. |
void |
addNotify()
Suppressed: Overrides JComponent.addNotify to register this
menu bar with the current keyboard manager. |
AccessibleContext |
getAccessibleContext()
Suppressed: Gets the AccessibleContext associated with this JMenuBar. |
Component |
getComponent()
Enabled: Implemented to be a MenuElement . |
Component |
getComponentAtIndex(int i)
Deprecated. replaced by getComponent(int i) |
int |
getComponentIndex(Component c)
Enabled: Returns the index of the specified component. |
JMenu |
getHelpMenu()
Enabled: Gets the help menu for the menu bar. |
Insets |
getMargin()
Enabled: Returns the margin between the menubar's border and its menus. |
JMenu |
getMenu(int index)
Enabled: Returns the menu at the specified position in the menu bar. |
int |
getMenuCount()
Enabled: Returns the number of items in the menu bar. |
SingleSelectionModel |
getSelectionModel()
Enabled: Returns the model object that handles single selections. |
MenuElement[] |
getSubElements()
Enabled: Implemented to be a MenuElement -- returns the
menus in this menu bar. |
javax.swing.plaf.MenuBarUI |
getUI()
Suppressed: Returns the menubar's current UI. |
String |
getUIClassID()
Suppressed: Returns the name of the L&F class that renders this component. |
boolean |
isBorderPainted()
Enabled: Returns true if the menu bars border should be painted. |
boolean |
isSelected()
Enabled: Returns true if the menu bar currently has a component selected. |
void |
menuSelectionChanged(boolean isIncluded)
Suppressed: Implemented to be a MenuElemen |
protected void |
paintBorder(Graphics g)
Paints the menubar's border if BorderPainted
property is true. |
protected String |
paramString()
Returns a string representation of this JMenuBar . |
(package private) static boolean |
processBindingForKeyStrokeRecursive(MenuElement elem,
KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
|
protected boolean |
processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
Subclassed to check all the child menus. |
void |
processKeyEvent(KeyEvent e,
MenuElement[] path,
MenuSelectionManager manager)
Suppressed: Implemented to be a MenuElement -- does nothing. |
void |
processMouseEvent(MouseEvent event,
MenuElement[] path,
MenuSelectionManager manager)
Suppressed: Implemented to be a MenuElement -- does nothing. |
private void |
readObject(ObjectInputStream s)
See JComponent.readObject() for information about serialization in Swing. |
void |
removeNotify()
Suppressed: Overrides JComponent.removeNotify to unregister this
menu bar with the current keyboard manager. |
void |
setBorderPainted(boolean b)
Enabled: Sets whether the border should be painted. |
void |
setHelpMenu(JMenu menu)
Enabled: Sets the help menu that appears when the user selects the "help" option in the menu bar. |
void |
setMargin(Insets m)
Enabled: Sets the margin between the menubar's border and its menus. |
void |
setSelected(Component sel)
Enabled: Sets the currently selected component, producing a a change to the selection model. |
void |
setSelectionModel(SingleSelectionModel model)
Enabled: Sets the model object to handle single selections. |
void |
setUI(javax.swing.plaf.MenuBarUI ui)
Suppressed: Sets the L&F object that renders this component. |
void |
updateUI()
Suppressed: Resets the UI property with a value from the current look and feel. |
private void |
writeObject(ObjectOutputStream s)
Before writing a JComponent to an
ObjectOutputStream we temporarily uninstall its UI. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String uiClassID
getUIClassID()
,
readObject(java.io.ObjectInputStream)
private transient SingleSelectionModel selectionModel
private boolean paintBorder
private Insets margin
private static final boolean TRACE
private static final boolean VERBOSE
private static final boolean DEBUG
Constructor Detail |
public JMenuBar()
Method Detail |
public javax.swing.plaf.MenuBarUI getUI()
setUI(javax.swing.plaf.MenuBarUI)
public void setUI(javax.swing.plaf.MenuBarUI ui)
ui
- the new MenuBarUI L&F objectUIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
updateUI
in class JComponent
JComponent.updateUI()
public String getUIClassID()
getUIClassID
in class JComponent
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public SingleSelectionModel getSelectionModel()
SingleSelectionModel
propertySingleSelectionModel
public void setSelectionModel(SingleSelectionModel model)
model
- the SingleSelectionModel
to useSingleSelectionModel
public JMenu add(JMenu c)
c
- the JMenu
component to add
public JMenu getMenu(int index)
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 int getMenuCount()
public void setHelpMenu(JMenu menu)
menu
- the JMenu that delivers help to the userpublic JMenu getHelpMenu()
JMenu
that delivers help to the userpublic Component getComponentAtIndex(int i)
getComponent(int i)
i
- an integer specifying the position, where 0 is first
Component
at the position,
or null
for an invalid indexpublic int getComponentIndex(Component c)
c
- the Component
to find
public void setSelected(Component sel)
sel
- the Component
to selectpublic boolean isSelected()
public boolean isBorderPainted()
public void setBorderPainted(boolean b)
b
- if true and border property is not null
,
the border is painted.isBorderPainted()
protected void paintBorder(Graphics g)
BorderPainted
property is true.
paintBorder
in class JComponent
g
- the Graphics
context to use for paintingJComponent.paint(java.awt.Graphics)
,
JComponent.setBorder(javax.swing.border.Border)
public void setMargin(Insets m)
null
will cause the menubar to
use the default margins.
Insets
public Insets getMargin()
Insets
object containing the margin valuesInsets
public void processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager)
MenuElement
-- does nothing.
processMouseEvent
in interface MenuElement
getSubElements()
public void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager manager)
MenuElement
-- does nothing.
processKeyEvent
in interface MenuElement
getSubElements()
public void menuSelectionChanged(boolean isIncluded)
MenuElement -- does nothing.
- Specified by:
menuSelectionChanged
in interface MenuElement
- See Also:
getSubElements()
public MenuElement[] getSubElements()
MenuElement
-- returns the
menus in this menu bar.
This is the reason for implementing the MenuElement
interface -- so that the menu bar can be treated the same as
other menu elements.
getSubElements
in interface MenuElement
public Component getComponent()
MenuElement
. Returns this object.
getComponent
in interface MenuElement
Component
(this)getSubElements()
protected String paramString()
JMenuBar
.
This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be null
.
paramString
in class JComponent
JMenuBar
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class JComponent
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)
processKeyBinding
in class JComponent
ks
- the KeyStroke
queriede
- the KeyEvent
condition
- one of the following values:
pressed
- true if the key is pressed
static boolean processBindingForKeyStrokeRecursive(MenuElement elem, KeyStroke ks, KeyEvent e, int condition, boolean pressed)
public void addNotify()
JComponent.addNotify
to register this
menu bar with the current keyboard manager.
addNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
public void removeNotify()
JComponent.removeNotify
to unregister this
menu bar with the current keyboard manager.
removeNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
private void writeObject(ObjectOutputStream s) throws IOException
JComponent
JComponent
to an
ObjectOutputStream
we temporarily uninstall its UI.
This is tricky to do because we want to uninstall
the UI before any of the JComponent
's children
(or its LayoutManager
etc.) are written,
and we don't want to restore the UI until the most derived
JComponent
subclass has been been stored.
s
- the ObjectOutputStream
in which to write
IOException
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
s
- the ObjectInputStream
from which to read
IOException
ClassNotFoundException
ReadObjectCallback
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |