public class SubmenuPiece extends MenuPiece
| Constructor and Description |
|---|
SubmenuPiece()
Creates a new submenu-piece, using a normal
JMenu to inserts
its content. |
SubmenuPiece(JMenu menu)
Creates a new submenu-piece.
|
SubmenuPiece(String text,
boolean disableWhenEmpty,
MenuPiece... pieces)
Creates a new submenu-piece, using a normal
JMenu. |
| Modifier and Type | Method and Description |
|---|---|
void |
bind()
This method is called if there is a possibility for the user to see this menu.
|
void |
fill(List<Component> items)
Inserts all items of this piece into
items. |
int |
getItemCount()
|
JMenu |
getMenu()
Gets the menu into which this
MenuPiece adds its items. |
RootMenuPiece |
getRoot()
Gets the root of this subtree.
|
boolean |
isDisableWhenEmpty()
Whether to disable the menu when it is empty or not.
|
boolean |
isEnabled()
Tells whether the submenu could be enabled.
|
void |
setDisableWhenEmpty(boolean disableWhenEmpty)
Disables the menu if there are no items in the menu.
|
void |
setEnabled(boolean enabled)
Sets whether the submenu can be enabled.
|
void |
unbind()
This method is called if the user has no longer any possibility to see this menu.
|
addListener, fireInsert, fireRemove, getParent, isBound, items, removeListener, setParentpublic SubmenuPiece()
JMenu to inserts
its content.public SubmenuPiece(String text, boolean disableWhenEmpty, MenuPiece... pieces)
JMenu.text - the text of the menudisableWhenEmpty - whether to disable the menu when it is emptypieces - the elements of this piecepublic SubmenuPiece(JMenu menu)
menu - the menu into which this piece will insert its contentpublic void bind()
MenuPiecebind in class MenuPieceMenuPiece.unbind()public void unbind()
MenuPieceunbind in class MenuPieceMenuPiece.bind()public void fill(List<Component> items)
MenuPieceitems.public int getItemCount()
MenuPiecegetItemCount in class MenuPiecepublic void setDisableWhenEmpty(boolean disableWhenEmpty)
disableWhenEmpty - true if the menu should be
disabled when emptypublic boolean isDisableWhenEmpty()
true if the menu gets disabledpublic void setEnabled(boolean enabled)
isDisableWhenEmpty().enabled - whether the submenu can be enabledpublic boolean isEnabled()
isDisableWhenEmpty()public JMenu getMenu()
MenuPieceMenuPiece adds its items.public RootMenuPiece getRoot()
Copyright © 2018. All rights reserved.