Package bibliothek.gui.dock.facile.menu
Class SubmenuPiece
java.lang.Object
bibliothek.gui.dock.support.menu.MenuPiece
bibliothek.gui.dock.facile.menu.SubmenuPiece
- Author:
- Benjamin Sigg
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new submenu-piece, using a normalJMenuto inserts its content.SubmenuPiece(String text, boolean disableWhenEmpty, MenuPiece... pieces) Creates a new submenu-piece, using a normalJMenu.SubmenuPiece(JMenu menu) Creates a new submenu-piece. -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()This method is called if there is a possibility for the user to see this menu.voidInserts all items of this piece intoitems.intgetMenu()Gets the menu into which thisMenuPieceadds its items.getRoot()Gets the root of this subtree.booleanWhether to disable the menu when it is empty or not.booleanTells whether the submenu could be enabled.voidsetDisableWhenEmpty(boolean disableWhenEmpty) Disables the menu if there are no items in the menu.voidsetEnabled(boolean enabled) Sets whether the submenu can be enabled.voidunbind()This method is called if the user has no longer any possibility to see this menu.Methods inherited from class bibliothek.gui.dock.support.menu.MenuPiece
addListener, fireInsert, fireRemove, getParent, isBound, items, removeListener, setParent
-
Constructor Details
-
SubmenuPiece
public SubmenuPiece()Creates a new submenu-piece, using a normalJMenuto inserts its content. -
SubmenuPiece
Creates a new submenu-piece.- Parameters:
menu- the menu into which this piece will insert its content
-
-
Method Details
-
bind
public void bind()Description copied from class:MenuPieceThis method is called if there is a possibility for the user to see this menu. The menu should register listeners, update its text etc. to be ready for that event. This method must never be called twice in a row. -
unbind
public void unbind()Description copied from class:MenuPieceThis method is called if the user has no longer any possibility to see this menu. The menu should unregister its listeners. This method must never be called twice in a row. -
fill
Description copied from class:MenuPieceInserts all items of this piece intoitems. -
getItemCount
public int getItemCount()Description copied from class:MenuPiece- Specified by:
getItemCountin classMenuPiece- Returns:
- the number of items
-
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
-
setEnabled
public void setEnabled(boolean enabled) Sets whether the submenu can be enabled. The actual state of the menu also depends onisDisableWhenEmpty().- Parameters:
enabled- whether the submenu can be enabled
-
isEnabled
public boolean isEnabled()Tells whether the submenu could be enabled. The actual state of the menu also depends onisDisableWhenEmpty()- Returns:
- whether the menu could be enabled
-
getMenu
Description copied from class:MenuPieceGets the menu into which thisMenuPieceadds its items. -
getRoot
Gets the root of this subtree.- Returns:
- the root
-