public class SubmenuPiece extends MenuPiece
Constructor and Description |
---|
SubmenuPiece()
Creates a new submenu-piece, using a normal
JMenu to inserts
its content. |
SubmenuPiece(javax.swing.JMenu menu)
Creates a new submenu-piece.
|
SubmenuPiece(java.lang.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(java.util.List<java.awt.Component> items)
Inserts all items of this piece into
items . |
int |
getItemCount()
|
javax.swing.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, setParent
public SubmenuPiece()
JMenu
to inserts
its content.public SubmenuPiece(java.lang.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(javax.swing.JMenu menu)
menu
- the menu into which this piece will insert its contentpublic void bind()
MenuPiece
bind
in class MenuPiece
MenuPiece.unbind()
public void unbind()
MenuPiece
unbind
in class MenuPiece
MenuPiece.bind()
public void fill(java.util.List<java.awt.Component> items)
MenuPiece
items
.public int getItemCount()
MenuPiece
getItemCount
in class MenuPiece
public 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 javax.swing.JMenu getMenu()
MenuPiece
MenuPiece
adds its items.public RootMenuPiece getRoot()