Search in sources :

Example 11 with Menu

use of java.awt.Menu in project processdash by dtuma.

the class ScriptMenuReplicator method addMenuItems.

private void addMenuItems(Menu destMenu, List menuItems, int pos) {
    for (Object item : menuItems) {
        if (item instanceof String) {
            String dataPath = (String) item;
            destMenu.insert(new ScriptMenuSeparator(), ++pos);
            destMenu.insert(new ScriptMenuHeader(dataPath), ++pos);
        } else if (item instanceof ScriptID) {
            ScriptID script = (ScriptID) item;
            destMenu.insert(new ScriptMenuItem(script), ++pos);
        } else if (item instanceof List) {
            Menu submenu = new ScriptMenuSubmenu();
            destMenu.insert(submenu, ++pos);
            addMenuItems(submenu, (List) item, -1);
        } else {
            System.out.println("Warning! Unrecognized menu item type " + item);
        }
    }
}
Also used : ScriptID(net.sourceforge.processdash.process.ScriptID) List(java.util.List) Menu(java.awt.Menu) PopupMenu(java.awt.PopupMenu)

Aggregations

Menu (java.awt.Menu)11 Dimension (java.awt.Dimension)3 Frame (java.awt.Frame)3 MenuBar (java.awt.MenuBar)3 MenuItem (java.awt.MenuItem)3 MemoryImageSource (java.awt.image.MemoryImageSource)3 PopupMenu (java.awt.PopupMenu)2 CheckboxMenuItem (java.awt.CheckboxMenuItem)1 FileDialog (java.awt.FileDialog)1 MenuShortcut (java.awt.MenuShortcut)1 MenuItemPeer (java.awt.peer.MenuItemPeer)1 List (java.util.List)1 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1 JPopupMenu (javax.swing.JPopupMenu)1 ScriptID (net.sourceforge.processdash.process.ScriptID)1