java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JMenuBar
Safe:
_bounds, accessibleContext, listenerList, paintingChild, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
JMenuBar()
void
addNotify()
JComponent.addNotify
to register this
menu bar with the current keyboard manager.
AccessibleContext
getAccessibleContext()
SingleSelectionModel
getSelectionModel()
MenuElement[]
getSubElements()
MenuElement
-- returns the
menus in this menu bar.
void
menuSelectionChanged(boolean isIncluded)
MenuElement -- does nothing.
protected void
paintBorder(Graphics g)
BorderPainted
property is true.
(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)
void
processKeyEvent(KeyEvent e,
MenuElement[] path,
MenuSelectionManager manager)
MenuElement
-- does nothing.
void
processMouseEvent(MouseEvent event,
MenuElement[] path,
MenuSelectionManager manager)
MenuElement
-- does nothing.
private void
readObject(ObjectInputStream s)
void
removeNotify()
JComponent.removeNotify
to unregister this
menu bar with the current keyboard manager.
void
setHelpMenu(JMenu menu)
void
setSelected(Component sel)
void
setSelectionModel(SingleSelectionModel model)
void
setUI(javax.swing.plaf.MenuBarUI ui)
private void
writeObject(ObjectOutputStream s)
JComponent
to an
ObjectOutputStream
we temporarily uninstall its UI.
_paintImmediately, addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, alwaysOnTop, checkIfChildObscuredBySibling, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getManagingFocusBackwardTraversalKeys, getManagingFocusForwardTraversalKeys, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getWriteObjCounter, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, rectangleIsObscured, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, setWriteObjCounter, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, get, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, iterate, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, size, transferFocusBackward, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, toString, transferFocus, transferFocus, transferFocusUpCycle
private static final String uiClassID
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
public JMenuBar()
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
public void removeNotify()
JComponent.removeNotify
to unregister this
menu bar with the current keyboard manager.
removeNotify
in class JComponent
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