|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.wordpress.tipsforjava.swing.MenuScroller
public class MenuScroller extends Object
A class that provides scrolling capabilities to a long menu dropdown or popup menu. A number of items can optionally be frozen at the top and/or bottom of the menu.
Implementation note: The default number of items to display at a time is 15, and the default scrolling interval is 125 milliseconds.
| Nested Class Summary | |
|---|---|
private static enum |
MenuScroller.MenuIcon
|
private class |
MenuScroller.MenuScrollItem
|
private class |
MenuScroller.MenuScrollListener
|
private class |
MenuScroller.MenuScrollTimer
|
| Field Summary | |
|---|---|
private int |
bottomFixedCount
|
private MenuScroller.MenuScrollItem |
downItem
|
private int |
firstIndex
|
private int |
interval
|
private JMenu |
menu
|
private Component[] |
menuItems
|
private MenuScroller.MenuScrollListener |
menuListener
|
private JPopupMenu |
popupMenu
|
private int |
scrollCount
|
private int |
topFixedCount
|
private MenuScroller.MenuScrollItem |
upItem
|
| Constructor Summary | |
MenuScroller(JMenu menu)
Constructs a |
|
MenuScroller(JPopupMenu menu)
Constructs a |
|
MenuScroller(JMenu menu, int scrollCount)
Constructs a |
|
MenuScroller(JPopupMenu menu, int scrollCount)
Constructs a |
|
MenuScroller(JMenu menu, int scrollCount, int interval)
Constructs a |
|
MenuScroller(JPopupMenu menu, int scrollCount, int interval)
Constructs a |
|
MenuScroller(JMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
Constructs a |
|
MenuScroller(JPopupMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
Constructs a |
|
| Method Summary | |
|---|---|
void
|
dispose()
Removes this MenuScroller from the associated menu and restores the default behavior of the menu. |
void
|
finalize()
Ensures that the |
int
|
getBottomFixedCount()
Returns the number of items fixed at the bottom of the menu or popup menu. |
int
|
getInterval()
Returns the scroll interval in milliseconds |
int
|
getTopFixedCount()
Returns the number of items fixed at the top of the menu or popup menu. |
int
|
getscrollCount()
Returns the number of items in the scrolling portion of the menu. |
private void
|
refreshMenu()
|
private void
|
restoreMenuItems()
|
void
|
setBottomFixedCount(int bottomFixedCount)
Sets the number of items to fix at the bottom of the menu or popup menu. |
void
|
setInterval(int interval)
Sets the scroll interval in milliseconds |
private void
|
setMenuItems()
|
void
|
setScrollCount(int scrollCount)
Sets the number of items in the scrolling portion of the menu. |
static MenuScroller
|
setScrollerFor(JMenu menu)
Registers a menu to be scrolled with the default number of items to display at a time and the default scrolling interval. |
static MenuScroller
|
setScrollerFor(JPopupMenu menu)
Registers a popup menu to be scrolled with the default number of items to display at a time and the default scrolling interval. |
static MenuScroller
|
setScrollerFor(JMenu menu, int scrollCount)
Registers a menu to be scrolled with the default number of items to display at a time and the specified scrolling interval. |
static MenuScroller
|
setScrollerFor(JPopupMenu menu, int scrollCount)
Registers a popup menu to be scrolled with the default number of items to display at a time and the specified scrolling interval. |
static MenuScroller
|
setScrollerFor(JMenu menu, int scrollCount, int interval)
Registers a menu to be scrolled, with the specified number of items to display at a time and the specified scrolling interval. |
static MenuScroller
|
setScrollerFor(JPopupMenu menu, int scrollCount, int interval)
Registers a popup menu to be scrolled, with the specified number of items to display at a time and the specified scrolling interval. |
static MenuScroller
|
setScrollerFor(JMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
Registers a menu to be scrolled, with the specified number of items to display in the scrolling region, the specified scrolling interval, and the specified numbers of items fixed at the top and bottom of the menu. |
static MenuScroller
|
setScrollerFor(JPopupMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
Registers a popup menu to be scrolled, with the specified number of items to display in the scrolling region, the specified scrolling interval, and the specified numbers of items fixed at the top and bottom of the popup menu. |
void
|
setTopFixedCount(int topFixedCount)
Sets the number of items to fix at the top of the menu or popup menu. |
private void
|
setValues(int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
|
MenuScroller
|
valueOf(String name)
Returns the enum constant of this type with the specified name. |
MenuScroller[]
|
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private int bottomFixedCount
private MenuScroller.MenuScrollItem downItem
private int firstIndex
private int interval
private JMenu menu
private Component[] menuItems
private final MenuScroller.MenuScrollListener menuListener
private JPopupMenu popupMenu
private int scrollCount
private int topFixedCount
private MenuScroller.MenuScrollItem upItem
| Constructor Detail |
|---|
public MenuScroller(JMenu menu)
MenuScroller that scrolls a menu with the
default number of items to display at a time, and default scrolling
interval.
menu - the menu
public MenuScroller(JPopupMenu menu)
MenuScroller that scrolls a popup menu with the
default number of items to display at a time, and default scrolling
interval.
menu - the popup menu
public MenuScroller(JMenu menu, int scrollCount)
MenuScroller that scrolls a menu with the
specified number of items to display at a time, and default scrolling
interval.
menu - the menuscrollCount - the number of items to display at a time
public MenuScroller(JPopupMenu menu, int scrollCount)
MenuScroller that scrolls a popup menu with the
specified number of items to display at a time, and default scrolling
interval.
menu - the popup menuscrollCount - the number of items to display at a time
public MenuScroller(JMenu menu, int scrollCount, int interval)
MenuScroller that scrolls a menu with the
specified number of items to display at a time, and specified scrolling
interval.
menu - the menuscrollCount - the number of items to display at a timeinterval - the scroll interval, in milliseconds
public MenuScroller(JPopupMenu menu, int scrollCount, int interval)
MenuScroller that scrolls a popup menu with the
specified number of items to display at a time, and specified scrolling
interval.
menu - the popup menuscrollCount - the number of items to display at a timeinterval - the scroll interval, in milliseconds
public MenuScroller(JMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
MenuScroller that scrolls a menu with the
specified number of items to display in the scrolling region, the
specified scrolling interval, and the specified numbers of items fixed at
the top and bottom of the menu.
menu - the menuscrollCount - the number of items to display in the scrolling portioninterval - the scroll interval, in millisecondstopFixedCount - the number of items to fix at the top. May be 0bottomFixedCount - the number of items to fix at the bottom. May be 0
public MenuScroller(JPopupMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
MenuScroller that scrolls a popup menu with the
specified number of items to display in the scrolling region, the
specified scrolling interval, and the specified numbers of items fixed at
the top and bottom of the popup menu.
menu - the popup menuscrollCount - the number of items to display in the scrolling portioninterval - the scroll interval, in millisecondstopFixedCount - the number of items to fix at the top. May be 0bottomFixedCount - the number of items to fix at the bottom. May be 0
| Method Detail |
|---|
public void dispose()
@Override public void finalize()
dispose method of this MenuScroller is
called when there are no more refrences to it.
public int getBottomFixedCount()
public int getInterval()
public int getTopFixedCount()
public int getscrollCount()
private void refreshMenu()
private void restoreMenuItems()
public void setBottomFixedCount(int bottomFixedCount)
bottomFixedCount - the number of items
public void setInterval(int interval)
interval - the scroll interval in milliseconds
private void setMenuItems()
public void setScrollCount(int scrollCount)
scrollCount - the number of items to display at a time
public static MenuScroller setScrollerFor(JMenu menu)
menu - the menu
public static MenuScroller setScrollerFor(JPopupMenu menu)
menu - the popup menu
public static MenuScroller setScrollerFor(JMenu menu, int scrollCount)
menu - the menuscrollCount - the number of items to display at a time
public static MenuScroller setScrollerFor(JPopupMenu menu, int scrollCount)
menu - the popup menuscrollCount - the number of items to display at a time
public static MenuScroller setScrollerFor(JMenu menu, int scrollCount, int interval)
menu - the menuscrollCount - the number of items to be displayed at a timeinterval - the scroll interval, in milliseconds
public static MenuScroller setScrollerFor(JPopupMenu menu, int scrollCount, int interval)
menu - the popup menuscrollCount - the number of items to be displayed at a timeinterval - the scroll interval, in milliseconds
public static MenuScroller setScrollerFor(JMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
menu - the menuscrollCount - the number of items to display in the scrolling portioninterval - the scroll interval, in millisecondstopFixedCount - the number of items to fix at the top. May be 0.bottomFixedCount - the number of items to fix at the bottom. May be 0
public static MenuScroller setScrollerFor(JPopupMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
menu - the popup menuscrollCount - the number of items to display in the scrolling portioninterval - the scroll interval, in millisecondstopFixedCount - the number of items to fix at the top. May be 0bottomFixedCount - the number of items to fix at the bottom. May be 0
public void setTopFixedCount(int topFixedCount)
topFixedCount - the number of items
private void setValues(int scrollCount, int interval, int topFixedCount, int bottomFixedCount)
MenuScroller valueOf(String name)
MenuScroller[] values()
Groovy Documentation