public class MenuItemPager
extends java.lang.Object
setItemsPerPage(int)
(default is
DEFAULT_ITEMS_PER_PAGE
).
add(JMenuItem)
for each item to add. A new submenu will be created and automatically
added to the current (sub)menu as necessary.
getFirstPage()
.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ITEMS_PER_PAGE |
Constructor and Description |
---|
MenuItemPager(javax.swing.JMenu menu) |
MenuItemPager(javax.swing.JPopupMenu menu) |
Modifier and Type | Method and Description |
---|---|
javax.swing.JMenuItem |
add(javax.swing.JMenuItem newItem)
Add an item to the menu.
|
java.util.List<javax.swing.JMenuItem> |
getFirstPage()
Get the "first page" of items (the items added directly to the provided root menu).
|
void |
setItemsPerPage(int itemsPerPage)
Set the size of the page (number of items allowed before a new submenu is created).
|
public static final int DEFAULT_ITEMS_PER_PAGE
public MenuItemPager(javax.swing.JPopupMenu menu)
public MenuItemPager(javax.swing.JMenu menu)
public void setItemsPerPage(int itemsPerPage)
itemsPerPage + 1
for the next
submenu.itemsPerPage
- Page sizepublic javax.swing.JMenuItem add(javax.swing.JMenuItem newItem)
newItem
- The item to addpublic java.util.List<javax.swing.JMenuItem> getFirstPage()