public class BMenu extends WidgetContainer implements MenuWidget
| Constructor and Description |
|---|
BMenu()
Create a new BMenu with no title.
|
BMenu(java.lang.String title)
Create a new BMenu.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(MenuWidget widget)
Add a MenuWidget (typically a BMenuItem or another BMenu) to the end of the menu.
|
void |
add(MenuWidget widget,
int index)
Add a MenuWidget (typically a BMenuItem or another BMenu) to the menu.
|
void |
addSeparator()
Add a dividing line (a BSeparator) to the end of the menu.
|
MenuWidget |
getChild(int i)
Get the i'th child of this container.
|
int |
getChildCount()
Get the number of children in this container.
|
java.util.Collection<Widget> |
getChildren()
Get a Collection containing all child Widgets of this container.
|
javax.swing.JMenu |
getComponent()
Get the java.awt.Component corresponding to this Widget.
|
int |
getMnemonic()
Get the mnemonic which can be used to activate this menu in keyboard navigation mode.
|
java.lang.String |
getText()
Get the title of this menu which appears in the menu bar.
|
void |
layoutChildren()
Layout the child Widgets.
|
void |
remove(Widget widget)
Remove a child Widget from this container.
|
void |
removeAll()
Remove all child Widgets from this container.
|
void |
setMnemonic(int key)
Set the mnemonic which can be used to activate this menu in keyboard navigation mode.
|
void |
setText(java.lang.String title)
Set the title of this menu which appears in the menu bar.
|
isOpaque, setOpaqueaddEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisibleaddEventLink, addEventLink, removeEventLinkpublic BMenu()
public BMenu(java.lang.String title)
title - the title of the menupublic javax.swing.JMenu getComponent()
WidgetgetComponent in class Widgetpublic java.lang.String getText()
public void setText(java.lang.String title)
public int getMnemonic()
public void setMnemonic(int key)
key - the key code (defined by the KeyEvent class) which activates this menupublic void add(MenuWidget widget)
widget - the MenuWidget to addpublic void add(MenuWidget widget, int index)
widget - the MenuWidget to addindex - the position at which to add itpublic void addSeparator()
public int getChildCount()
getChildCount in class WidgetContainerpublic MenuWidget getChild(int i)
public java.util.Collection<Widget> getChildren()
getChildren in class WidgetContainerpublic void remove(Widget widget)
remove in class WidgetContainerpublic void removeAll()
removeAll in class WidgetContainerpublic void layoutChildren()
layoutChildren in class WidgetContainerWritten by Peter Eastman.