@@ -0,0 +1,2095 @@
+/*%0A * JaamSim Discrete Event Simulation%0A * Copyright (C) 2018 JaamSim Software Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.jaamsim.ui;%0A%0Aimport javax.swing.JMenu;%0Aimport javax.swing.JMenuItem;%0Aimport javax.swing.JPopupMenu;%0Aimport javax.swing.UIManager;%0Aimport javax.swing.plaf.MenuItemUI;%0Aimport javax.swing.plaf.PopupMenuUI;%0A%0Apublic class ScrollableMenu extends JMenu %7B%0A%0A%09private JPopupMenu popupMenu;  // JMenu has a private property with the same name%0A%0A%09public ScrollableMenu(String s) %7B%0A%09%09super(s);%0A%09%7D%0A%0A%09/**%0A%09 * Mirrors the private method for JMenu with the same name%0A%09 */%0A%09protected void ensurePopupMenuCreated() %7B%0A%09%09if (popupMenu == null) %7B%0A%09%09%09popupMenu = new ScrollablePopupMenu();%0A%09%09%09popupMenu.setInvoker(this);%0A%09%09%09popupListener = createWinListener(popupMenu);%0A%09%09%7D%0A%09%7D%0A%0A%09// The following methods are the minimum for this application that need to be over-loaded%0A%09// to refer to the new popupmenu property and ensurePopupMenuCreated method.%0A%09// For full functionality, every method in JMenu that refers to popupMenu should be over-loaded.%0A%0A%09@Override%0A%09public JPopupMenu getPopupMenu() %7B%0A%09%09ensurePopupMenuCreated();%0A%09%09return popupMenu;%0A%09%7D%0A%0A%09@Override%0A%09public JMenuItem add(JMenuItem menuItem) %7B%0A%09%09ensurePopupMenuCreated();%0A%09%09return popupMenu.add(menuItem);%0A%09%7D%0A%0A%09@Override%0A%09public boolean isPopupMenuVisible() %7B%0A%09%09ensurePopupMenuCreated();%0A%09%09return popupMenu.isVisible();%0A%09%7D%0A%0A%09@Override%0A%09public void updateUI() %7B%0A%09%09setUI((MenuItemUI) UIManager.getUI(this));%0A%09%09if (popupMenu != null) %7B%0A%09%09%09popupMenu.setUI((PopupMenuUI) UIManager.getUI(popupMenu));%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

add ScrollableMenu class