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.Constructor and description |
---|
MenuScroller
(javax.swing.JMenu menu) Constructs a MenuScroller that scrolls a menu with the
default number of items to display at a time, and default scrolling
interval. |
MenuScroller
(javax.swing.JPopupMenu menu) Constructs a MenuScroller that scrolls a popup menu with the
default number of items to display at a time, and default scrolling
interval. |
MenuScroller
(javax.swing.JMenu menu, int scrollCount) Constructs a MenuScroller that scrolls a menu with the
specified number of items to display at a time, and default scrolling
interval. |
MenuScroller
(javax.swing.JPopupMenu menu, int scrollCount) Constructs a MenuScroller that scrolls a popup menu with the
specified number of items to display at a time, and default scrolling
interval. |
MenuScroller
(javax.swing.JMenu menu, int scrollCount, int interval) Constructs a MenuScroller that scrolls a menu with the
specified number of items to display at a time, and specified scrolling
interval. |
MenuScroller
(javax.swing.JPopupMenu menu, int scrollCount, int interval) Constructs a MenuScroller that scrolls a popup menu with the
specified number of items to display at a time, and specified scrolling
interval. |
MenuScroller
(javax.swing.JMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount) Constructs a 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. |
MenuScroller
(javax.swing.JPopupMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount) Constructs a 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. |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
dispose() Removes this MenuScroller from the associated menu and restores the default behavior of the menu. |
|
void |
finalize() Ensures that the dispose method of this MenuScroller is
called when there are no more refrences to it. |
|
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. |
|
void |
keepVisible(javax.swing.JMenuItem item) Scrolls the specified item into view each time the menu is opened. |
|
void |
keepVisible(int index) Scrolls the item at the specified index into view each time the menu is opened. |
|
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 |
|
void |
setScrollCount(int scrollCount) Sets the number of items in the scrolling portion of the menu. |
|
static MenuScroller |
setScrollerFor(javax.swing.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(javax.swing.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(javax.swing.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(javax.swing.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(javax.swing.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(javax.swing.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(javax.swing.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(javax.swing.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. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructs a MenuScroller
that scrolls a menu with the
default number of items to display at a time, and default scrolling
interval.
menu
- the menu Constructs a 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 Constructs a 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 Constructs a 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 Constructs a 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 Constructs a 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 Constructs a 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 Constructs a 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 0Removes this MenuScroller from the associated menu and restores the default behavior of the menu.
Ensures that the dispose
method of this MenuScroller is
called when there are no more refrences to it.
Returns the number of items fixed at the bottom of the menu or popup menu.
Returns the scroll interval in milliseconds
Returns the number of items fixed at the top of the menu or popup menu.
Returns the number of items in the scrolling portion of the menu.
Scrolls the specified item into view each time the menu is opened. Call
this method with null
to restore the default behavior, which
is to show the menu as it last appeared.
item
- the item to keep visible Scrolls the item at the specified index into view each time the menu is
opened. Call this method with -1
to restore the default
behavior, which is to show the menu as it last appeared.
index
- the index of the item to keep visibleSets the number of items to fix at the bottom of the menu or popup menu.
bottomFixedCount
- the number of itemsSets the scroll interval in milliseconds
interval
- the scroll interval in millisecondsSets the number of items in the scrolling portion of the menu.
scrollCount
- the number of items to display at a timeRegisters a menu to be scrolled with the default number of items to display at a time and the default scrolling interval.
menu
- the menuRegisters a popup menu to be scrolled with the default number of items to display at a time and the default scrolling interval.
menu
- the popup menuRegisters a menu to be scrolled with the default number of items to display at a time and the specified scrolling interval.
menu
- the menuscrollCount
- the number of items to display at a timeRegisters a popup menu to be scrolled with the default number of items to display at a time and the specified scrolling interval.
menu
- the popup menuscrollCount
- the number of items to display at a timeRegisters a menu to be scrolled, with the specified number of items to display at a time and the specified scrolling interval.
menu
- the menuscrollCount
- the number of items to be displayed at a timeinterval
- the scroll interval, in millisecondsRegisters a popup menu to be scrolled, with the specified number of items to display at a time and the specified scrolling interval.
menu
- the popup menuscrollCount
- the number of items to be displayed at a timeinterval
- the scroll interval, in millisecondsRegisters 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.
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 0Registers 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.
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 0Sets the number of items to fix at the top of the menu or popup menu.
topFixedCount
- the number of items