|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jmex.bui.BComponent
com.jmex.bui.BTextComponent
com.jmex.bui.BLabel
com.jmex.bui.BMenu
public class BMenu
Displays a menu of items when clicked, one of which can be selected.
Example:
BWindow window = new BDecoratedWindow(style, null);
BMenuBar bar = window.getMenuBar();
BMenu fileMenu = new BMenu("File", window);
BMenuItem newItem = new BMenuItem("New Item", "NEW");
newItem.addListener(this);
fileMenu.addMenuItem(newItem);
BMenuItem exitItem = new BMenuItem("Exit", "EXIT");
exitItem.addListener(this);
fileMenu.addMenuItem(exitItem);
bar.add(fileMenu);
Styles:
menu {
border: 1 solid #999999;
background: solid #66666688;
}
menu:hover {
border: 1 solid #336699;
}
menubar {
background: solid #66666688;
}
menuitem {
border: 1 solid #999999;
background: solid #66666688;
}
menuitem:hover {
border: 1 solid #336699;
}
| Nested Class Summary | |
|---|---|
protected class |
BMenu.MenuItem
|
protected class |
BMenu.MenuPopupMenu
|
| Nested classes/interfaces inherited from class com.jmex.bui.BLabel |
|---|
BLabel.Fit |
| Field Summary | |
|---|---|
protected java.lang.String |
_action
|
protected BMenu.MenuPopupMenu |
_menu
|
| Fields inherited from class com.jmex.bui.BLabel |
|---|
_label |
| Fields inherited from class com.jmex.bui.BTextComponent |
|---|
_effcols, _effsizes, _haligns, _teffects, _textfacts, _valigns |
| Fields inherited from class com.jmex.bui.BComponent |
|---|
_alpha, _backgrounds, _bbuf, _borders, _colors, _cursor, _enabled, _height, _hover, _insets, _listeners, _parent, _preferredSize, _properties, _styleClass, _tipmouse, _tipStyle, _tiptext, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES |
| Constructor Summary | |
|---|---|
BMenu(java.lang.String text,
ActionListener listener,
java.lang.String action,
BWindow parentWindow)
Creates a menu with the specified label and action. |
|
BMenu(java.lang.String text,
BWindow parentWindow)
Creates a menu with the specified textual label. |
|
BMenu(java.lang.String text,
java.lang.String action,
BWindow parentWindow)
Creates a menu with the specified label and action. |
|
| Method Summary | |
|---|---|
void |
addMenuItem(BMenuItem item)
Adds the supplied item to this menu. |
boolean |
dispatchEvent(BEvent event)
Instructs this component to process the supplied event. |
protected void |
fireAction(long when,
int modifiers)
Called when the button is "clicked" which may due to the mouse being pressed and released while over the button or due to keyboard manipulation while the button has focus. |
java.lang.String |
getAction()
Returns the action generated when this menu is clicked. |
protected java.lang.String |
getDefaultStyleClass()
Returns the default stylesheet class to be used for all instances of this component. |
void |
setAction(java.lang.String action)
Configures the action to be generated when this menu is clicked. |
| Methods inherited from class com.jmex.bui.BLabel |
|---|
computePreferredSize, getFit, getIcon, getIconTextGap, getText, layout, renderComponent, setFit, setIcon, setIconTextGap, setOrientation, setText, wasAdded, wasRemoved |
| Methods inherited from class com.jmex.bui.BTextComponent |
|---|
checkNonDefault, configureStyle, getEffectColor, getEffectSize, getHorizontalAlignment, getLabelConfig, getTextEffect, getTextFactory, getVerticalAlignment |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String _action
protected BMenu.MenuPopupMenu _menu
| Constructor Detail |
|---|
public BMenu(java.lang.String text,
BWindow parentWindow)
public BMenu(java.lang.String text,
java.lang.String action,
BWindow parentWindow)
ActionEvent when the menu is clicked.
public BMenu(java.lang.String text,
ActionListener listener,
java.lang.String action,
BWindow parentWindow)
ActionEvent to the specified
ActionListener when the menu is clicked.
| Method Detail |
|---|
public void setAction(java.lang.String action)
public java.lang.String getAction()
public boolean dispatchEvent(BEvent event)
BComponentsuper.dispatchEvent for events that they did not "consume".
dispatchEvent in class BComponentpublic void addMenuItem(BMenuItem item)
protected java.lang.String getDefaultStyleClass()
BComponent
getDefaultStyleClass in class BLabel
protected void fireAction(long when,
int modifiers)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||