/** * Registers a menu to be scrolled with the default number of items to * display at a time and the default scrolling interval. * * @param menu the menu * @return the MenuScroller */ public static MenuScroller setScrollerFor(JMenu menu) { return new MenuScroller(menu); }
/** * Ensures that the <code>dispose</code> method of this MenuScroller is * called when there are no more refrences to it. * * @exception Throwable if an error occurs. * @see MenuScroller#dispose() */ @Override public void finalize() throws Throwable { dispose(); }
/** * Take any given memu object and turn on scrollbars if it contains more than 20 items. * Then, cycle through all submenus recursively. * * @param menu */ public static void createScrollBarsOnMenus(JMenu menu) { if (menu.getMenuComponentCount() > 20) { MenuScroller.setScrollerFor(menu, 20); } for (int i = 0; i < menu.getMenuComponentCount(); i++) { if (menu.getMenuComponent(i) instanceof JMenu) { MenuScroller.createScrollBarsOnMenus(((JMenu)menu.getMenuComponent(i))); } } } }
setScrollCount(scrollCount); setInterval(interval); setTopFixedCount(topFixedCount); setBottomFixedCount(bottomFixedCount);
MenuScroller.setScrollerFor(menu, 20);
if (menu.getMenuComponentCount() > 0) { menu.setEnabled((isOwner || isBot) && allUnloaded); MenuScroller.createScrollBarsOnMenus(menu); popup.add(menu); MenuScroller.createScrollBarsOnMenus(menuDocking); popup.add(menuDocking); MenuScroller.createScrollBarsOnMenus(menuSquadrons); popup.add(menuSquadrons); MenuScroller.createScrollBarsOnMenus(menuMounting); popup.add(menuMounting); MenuScroller.createScrollBarsOnMenus(menuClamp); popup.add(menuClamp); && !(hasMounting || hasSquadrons || hasDocking || hasLoad || hasClamp)) { menuLoadAll.setEnabled((isOwner || isBot) && allUnloaded); MenuScroller.createScrollBarsOnMenus(menuLoadAll); popup.add(menuLoadAll);
MenuScroller.createScrollBarsOnMenus(menu); popup.add(menu); MenuScroller.createScrollBarsOnMenus(menu); popup.add(menu); MenuScroller.createScrollBarsOnMenus(menu); popup.add(menu); MenuScroller.createScrollBarsOnMenus(networkMenu); popup.add(networkMenu); MenuScroller.setScrollerFor(missionMenu, 30); MenuScroller.createScrollBarsOnMenus(menu); popup.add(menu);
MenuScroller.setScrollerFor(ammoMenu, 20); MenuScroller.setScrollerFor(menu, 20); popup.add(menu); if (menu.getItemCount() > 20) { MenuScroller.setScrollerFor(menu, 20);
MenuScroller.setScrollerFor(submenu, MAX_POPUP_ITEMS); MenuScroller.setScrollerFor(menu, MAX_POPUP_ITEMS); MenuScroller.setScrollerFor(menu, MAX_POPUP_ITEMS); MenuScroller.setScrollerFor(menu, MAX_POPUP_ITEMS); MenuScroller.setScrollerFor(menu, MAX_POPUP_ITEMS); MenuScroller.setScrollerFor(menu, MAX_POPUP_ITEMS); MenuScroller.setScrollerFor(menu, MAX_POPUP_ITEMS); MenuScroller.setScrollerFor(menu, MAX_POPUP_ITEMS); MenuScroller.setScrollerFor(menu, MAX_POPUP_ITEMS); menu.add(pilotMenu); if (pilotMenu.getItemCount() > MAX_POPUP_ITEMS) { MenuScroller.setScrollerFor(pilotMenu, MAX_POPUP_ITEMS); menu.add(driverMenu); if (driverMenu.getItemCount() > MAX_POPUP_ITEMS) { MenuScroller.setScrollerFor(driverMenu, MAX_POPUP_ITEMS); menu.add(crewMenu); if (crewMenu.getItemCount() > MAX_POPUP_ITEMS) { MenuScroller.setScrollerFor(crewMenu, MAX_POPUP_ITEMS);
/** * Registers a menu to be scrolled with the default number of items to * display at a time and the specified scrolling interval. * * @param menu the menu * @param scrollCount the number of items to display at a time * @return the MenuScroller * @throws IllegalArgumentException if scrollCount is 0 or negative */ public static MenuScroller setScrollerFor(JMenu menu, int scrollCount) { return new MenuScroller(menu, scrollCount); }
/** * Registers a popup menu to be scrolled with the default number of items to * display at a time and the default scrolling interval. * * @param menu the popup menu * @return the MenuScroller */ public static MenuScroller setScrollerFor(JPopupMenu menu) { return new MenuScroller(menu); }
/** * Registers a popup menu to be scrolled with the default number of items to * display at a time and the specified scrolling interval. * * @param menu the popup menu * @param scrollCount the number of items to display at a time * @return the MenuScroller * @throws IllegalArgumentException if scrollCount is 0 or negative */ public static MenuScroller setScrollerFor(JPopupMenu menu, int scrollCount) { return new MenuScroller(menu, scrollCount); }
/** * Registers a popup menu to be scrolled, with the specified number of items to * display at a time and the specified scrolling interval. * * @param menu the popup menu * @param scrollCount the number of items to be displayed at a time * @param interval the scroll interval, in milliseconds * @return the MenuScroller * @throws IllegalArgumentException if scrollCount or interval is 0 or negative */ public static MenuScroller setScrollerFor(JPopupMenu menu, int scrollCount, int interval) { return new MenuScroller(menu, scrollCount, interval); }
/** * Registers a menu to be scrolled, with the specified number of items to * display at a time and the specified scrolling interval. * * @param menu the menu * @param scrollCount the number of items to be displayed at a time * @param interval the scroll interval, in milliseconds * @return the MenuScroller * @throws IllegalArgumentException if scrollCount or interval is 0 or negative */ public static MenuScroller setScrollerFor(JMenu menu, int scrollCount, int interval) { return new MenuScroller(menu, scrollCount, interval); }
/** * 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. * * @param menu the menu * @param scrollCount the number of items to display in the scrolling portion * @param interval the scroll interval, in milliseconds * @param topFixedCount the number of items to fix at the top. May be 0. * @param bottomFixedCount the number of items to fix at the bottom. May be 0 * @throws IllegalArgumentException if scrollCount or interval is 0 or * negative or if topFixedCount or bottomFixedCount is negative * @return the MenuScroller */ public static MenuScroller setScrollerFor(JMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount) { return new MenuScroller(menu, scrollCount, interval, topFixedCount, 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. * * @param menu the popup menu * @param scrollCount the number of items to display in the scrolling portion * @param interval the scroll interval, in milliseconds * @param topFixedCount the number of items to fix at the top. May be 0 * @param bottomFixedCount the number of items to fix at the bottom. May be 0 * @throws IllegalArgumentException if scrollCount or interval is 0 or * negative or if topFixedCount or bottomFixedCount is negative * @return the MenuScroller */ public static MenuScroller setScrollerFor(JPopupMenu menu, int scrollCount, int interval, int topFixedCount, int bottomFixedCount) { return new MenuScroller(menu, scrollCount, interval, topFixedCount, bottomFixedCount); }