public class MenuScroller extends Object
| Constructor and Description | 
|---|
| MenuScroller(JMenu menu)Constructs a  MenuScrollerthat scrolls a menu with the
 default number of items to display at a time, and default scrolling
 interval. | 
| MenuScroller(JMenu menu,
            int scrollCount)Constructs a  MenuScrollerthat scrolls a menu with the
 specified number of items to display at a time, and default scrolling
 interval. | 
| MenuScroller(JMenu menu,
            int scrollCount,
            int interval)Constructs a  MenuScrollerthat scrolls a menu with the
 specified number of items to display at a time, and specified scrolling
 interval. | 
| MenuScroller(JMenu menu,
            int scrollCount,
            int interval,
            int topFixedCount,
            int bottomFixedCount)Constructs a  MenuScrollerthat 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(JPopupMenu menu)Constructs a  MenuScrollerthat scrolls a popup menu with the
 default number of items to display at a time, and default scrolling
 interval. | 
| MenuScroller(JPopupMenu menu,
            int scrollCount)Constructs a  MenuScrollerthat scrolls a popup menu with the
 specified number of items to display at a time, and default scrolling
 interval. | 
| MenuScroller(JPopupMenu menu,
            int scrollCount,
            int interval)Constructs a  MenuScrollerthat scrolls a popup menu with the
 specified number of items to display at a time, and specified scrolling
 interval. | 
| MenuScroller(JPopupMenu menu,
            int scrollCount,
            int interval,
            int topFixedCount,
            int bottomFixedCount)Constructs a  MenuScrollerthat 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. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | dispose()Removes this MenuScroller from the associated menu and restores the
 default behavior of the menu. | 
| void | finalize()Ensures that the  disposemethod 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 | getscrollCount()Returns the number of items in the scrolling portion of the menu. | 
| int | getTopFixedCount()Returns the number of items fixed at the top of the menu or popup menu. | 
| void | keepVisible(int index)Scrolls the item at the specified index into view each time the menu is
 opened. | 
| void | keepVisible(JMenuItem item)Scrolls the specified item 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(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(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(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(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)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(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(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(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. | 
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 menupublic 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 menupublic 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 timeIllegalArgumentException - if scrollCount is 0 or negativepublic 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 timeIllegalArgumentException - if scrollCount is 0 or negativepublic 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 millisecondsIllegalArgumentException - if scrollCount or interval is 0 or negativepublic 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 millisecondsIllegalArgumentException - if scrollCount or interval is 0 or negativepublic 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 0IllegalArgumentException - if scrollCount or interval is 0 or negative or if topFixedCount
                                  or bottomFixedCount is negativepublic 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 0IllegalArgumentException - if scrollCount or interval is 0 or negative or if topFixedCount
                                  or bottomFixedCount is negativepublic static MenuScroller setScrollerFor(JMenu menu)
menu - the menupublic static MenuScroller setScrollerFor(JPopupMenu menu)
menu - the popup menupublic static MenuScroller setScrollerFor(JMenu menu, int scrollCount)
menu - the menuscrollCount - the number of items to display at a timeIllegalArgumentException - if scrollCount is 0 or negativepublic static MenuScroller setScrollerFor(JPopupMenu menu, int scrollCount)
menu - the popup menuscrollCount - the number of items to display at a timeIllegalArgumentException - if scrollCount is 0 or negativepublic 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 millisecondsIllegalArgumentException - if scrollCount or interval is 0 or negativepublic 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 millisecondsIllegalArgumentException - if scrollCount or interval is 0 or negativepublic 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 0IllegalArgumentException - if scrollCount or interval is 0 or negative or if topFixedCount
                                  or bottomFixedCount is negativepublic 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 0IllegalArgumentException - if scrollCount or interval is 0 or negative or if topFixedCount
                                  or bottomFixedCount is negativepublic int getInterval()
public void setInterval(int interval)
interval - the scroll interval in millisecondsIllegalArgumentException - if interval is 0 or negativepublic int getscrollCount()
public void setScrollCount(int scrollCount)
scrollCount - the number of items to display at a timeIllegalArgumentException - if scrollCount is 0 or negativepublic int getTopFixedCount()
public void setTopFixedCount(int topFixedCount)
topFixedCount - the number of itemspublic int getBottomFixedCount()
public void setBottomFixedCount(int bottomFixedCount)
bottomFixedCount - the number of itemspublic void keepVisible(JMenuItem item)
null to restore the default behavior, which
 is to show the menu as it last appeared.item - the item to keep visiblekeepVisible(int)public void keepVisible(int index)
-1 to restore the default
 behavior, which is to show the menu as it last appeared.index - the index of the item to keep visiblekeepVisible(javax.swing.JMenuItem)public void dispose()
Copyright © 2019. All Rights Reserved.