Package bibliothek.gui.dock.facile.menu
Class RootMenuPiece
java.lang.Object
bibliothek.gui.dock.support.menu.MenuPiece
bibliothek.gui.dock.facile.menu.NodeMenuPiece
bibliothek.gui.dock.facile.menu.RootMenuPiece
- Author:
- Benjamin Sigg
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new root-piece, using a normalJMenuto inserts its content.RootMenuPiece(String text, boolean disableWhenEmpty, MenuPiece... pieces) Creates a new root-piece, using a normalJMenu.RootMenuPiece(JMenu menu) Creates a new root-piece. -
Method Summary
Modifier and TypeMethodDescriptiongetMenu()Gets the menu into which thisMenuPieceadds its items.booleanWhether to disable the menu when it is empty or not.booleanTells whether the menu can be enabled or not.voidsetDisableWhenEmpty(boolean disableWhenEmpty) Disables the menu if there are no items in the menu.voidsetEnabled(boolean enabled) Enables or disables the menu.voidSets the parent of this piece.protected voidCallsJMenuItem.setEnabled(boolean)with a parameter that is calculated usingisDisableWhenEmpty(),NodeMenuPiece.getItemCount()andMethods inherited from class bibliothek.gui.dock.facile.menu.NodeMenuPiece
add, bind, fill, getChild, getChildrenCount, getItemCount, insert, remove, remove, unbindMethods inherited from class bibliothek.gui.dock.support.menu.MenuPiece
addListener, fireInsert, fireRemove, getParent, isBound, items, removeListener
-
Constructor Details
-
RootMenuPiece
public RootMenuPiece()Creates a new root-piece, using a normalJMenuto inserts its content. -
RootMenuPiece
Creates a new root-piece.- Parameters:
menu- the menu into which this piece will insert its content
-
-
Method Details
-
updateEnabled
protected void updateEnabled()CallsJMenuItem.setEnabled(boolean)with a parameter that is calculated usingisDisableWhenEmpty(),NodeMenuPiece.getItemCount()and -
setDisableWhenEmpty
public void setDisableWhenEmpty(boolean disableWhenEmpty) Disables the menu if there are no items in the menu.- Parameters:
disableWhenEmpty-trueif the menu should be disabled when empty
-
isDisableWhenEmpty
public boolean isDisableWhenEmpty()Whether to disable the menu when it is empty or not.- Returns:
trueif the menu gets disabled- See Also:
-
setEnabled
public void setEnabled(boolean enabled) Enables or disables the menu. If the argument isfalse, then the menu is disabled in any case. Otherwise the menu may be enabled or disabled depending on the value ofisDisableWhenEmpty().- Parameters:
enabled- wether the menu should be enabled- See Also:
-
isEnabled
public boolean isEnabled()Tells whether the menu can be enabled or not.- Returns:
trueif the menu can be enabled
-
getMenu
Description copied from class:MenuPieceGets the menu into which thisMenuPieceadds its items.
-