Search in sources :

Example 6 with Menu

use of java.awt.Menu in project jdk8u_jdk by JetBrains.

the class MenuBarSetFont method addMenu.

private static void addMenu() {
    mb.add(new Menu("w"));
    frame.validate();
}
Also used : Menu(java.awt.Menu)

Example 7 with Menu

use of java.awt.Menu in project jdk8u_jdk by JetBrains.

the class RemoveHelpMenu method test4.

private static void test4(final MenuBar menuBar) {
    final Menu helpMenu = new Menu("Help Menu");
    menuBar.setHelpMenu(helpMenu);
    checkCurrentMenu(menuBar, helpMenu);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu, true);
    menuBar.setHelpMenu(null);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu, false);
}
Also used : Menu(java.awt.Menu)

Example 8 with Menu

use of java.awt.Menu in project jdk8u_jdk by JetBrains.

the class AWTInputMethodPopupMenu method addMenuItem.

void addMenuItem(Object targetMenu, String label, String command, String currentSelection) {
    MenuItem menuItem;
    if (isSelected(command, currentSelection)) {
        menuItem = new CheckboxMenuItem(label, true);
    } else {
        menuItem = new MenuItem(label);
    }
    menuItem.setActionCommand(command);
    menuItem.addActionListener(this);
    menuItem.setEnabled(command != null);
    ((Menu) targetMenu).add(menuItem);
}
Also used : CheckboxMenuItem(java.awt.CheckboxMenuItem) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) MenuItem(java.awt.MenuItem) JMenuItem(javax.swing.JMenuItem) CheckboxMenuItem(java.awt.CheckboxMenuItem) JPopupMenu(javax.swing.JPopupMenu) JMenu(javax.swing.JMenu) Menu(java.awt.Menu) PopupMenu(java.awt.PopupMenu)

Example 9 with Menu

use of java.awt.Menu in project voltdb by VoltDB.

the class DatabaseManager method main.

public void main() {
    fMain = new Frame("HSQL Database Manager");
    imgEmpty = createImage(new MemoryImageSource(2, 2, new int[4 * 4], 2, 2));
    fMain.setIconImage(imgEmpty);
    fMain.addWindowListener(this);
    MenuBar bar = new MenuBar();
    // used shortcuts: CERGTSIUDOLM
    String[] fitems = { "-Connect...", "--", "-Open Script...", "-Save Script...", "-Save Result...", "-Save Result csv...", "--", "-Exit" };
    addMenu(bar, "File", fitems);
    String[] vitems = { "RRefresh Tree", "--", "GResults in Grid", "TResults in Text", "--", "1Shrink Tree", "2Enlarge Tree", "3Shrink Command", "4Enlarge Command" };
    addMenu(bar, "View", vitems);
    String[] sitems = { "SSELECT", "IINSERT", "UUPDATE", "DDELETE", "--", "-CREATE TABLE", "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX", "--", "-CHECKPOINT", "-SCRIPT", "-SET", "-SHUTDOWN", "--", "-Test Script" };
    addMenu(bar, "Command", sitems);
    Menu recent = new Menu("Recent");
    mRecent = new Menu("Recent");
    bar.add(mRecent);
    String[] soptions = { "-AutoCommit on", "-AutoCommit off", "OCommit", "LRollback", "--", "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on", "-Logging off", "--", "-Insert test data" };
    addMenu(bar, "Options", soptions);
    String[] stools = { "-Dump", "-Restore", "-Transfer" };
    addMenu(bar, "Tools", stools);
    Menu hMenu = new Menu("Help");
    MenuItem aItem = new MenuItem("About");
    aItem.setShortcut(new MenuShortcut('A'));
    aItem.addActionListener(this);
    hMenu.add(aItem);
    MenuItem hItem = new MenuItem("Help");
    hItem.setShortcut(new MenuShortcut('H'));
    hItem.addActionListener(this);
    hMenu.add(hItem);
    //bar.add(hMenu);
    // Command above disabled only until a help display bug is fixed.
    fMain.setMenuBar(bar);
    fMain.setSize(640, 480);
    fMain.add("Center", this);
    initGUI();
    sRecent = new String[iMaxRecent];
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension size = fMain.getSize();
    // (ulrivo): full size on screen with less than 640 width
    if (d.width >= 640) {
        fMain.setLocation((d.width - size.width) / 2, (d.height - size.height) / 2);
    } else {
        fMain.setLocation(0, 0);
        fMain.setSize(d);
    }
    fMain.show();
    // (ulrivo): load query from command line
    if (defScript != null) {
        if (defDirectory != null) {
            defScript = defDirectory + File.separator + defScript;
        }
        txtCommand.setText(DatabaseManagerCommon.readFile(defScript));
    }
    txtCommand.requestFocus();
}
Also used : Frame(java.awt.Frame) MenuBar(java.awt.MenuBar) MenuItem(java.awt.MenuItem) Menu(java.awt.Menu) MenuShortcut(java.awt.MenuShortcut) Dimension(java.awt.Dimension) MemoryImageSource(java.awt.image.MemoryImageSource)

Example 10 with Menu

use of java.awt.Menu in project voltdb by VoltDB.

the class ZaurusDatabaseManager method main.

/**
     * Method declaration
     *
     */
public void main() {
    fMain = new Frame("HSQLDB Database Manager for Zaurus");
    imgEmpty = createImage(new MemoryImageSource(2, 2, new int[4 * 4], 2, 2));
    fMain.setIconImage(imgEmpty);
    fMain.addWindowListener(this);
    MenuBar bar = new MenuBar();
    // no shortcuts used
    String[] fitems = { "-Connect...", "--", "-Open Script...", "-Save Script...", "-Save Result...", "--", "-Exit" };
    addMenu(bar, "File", fitems);
    String[] vitems = { "-Refresh Tree", "--", "-View Tree", "-View Command", "-View Result", "-View Editor", "--", "-Results in Grid", "-Results in Text" };
    addMenu(bar, "View", vitems);
    String[] sitems = { "-SELECT", "-INSERT", "-UPDATE", "-DELETE", "--", "-CREATE TABLE", "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX", "--", "-SCRIPT", "-SHUTDOWN", "--", "-Test Script" };
    addMenu(bar, "SQL", sitems);
    Menu recent = new Menu("Recent");
    mRecent = new Menu("Recent");
    bar.add(mRecent);
    String[] soptions = { "-AutoCommit on", "-AutoCommit off", "-Commit", "-Rollback", "--", "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on", "-Logging off", "--", // , "-Transfer"
    "-Insert test data" };
    addMenu(bar, "Options", soptions);
    String[] shelp = { "-Show HTML-Help in browser" };
    addMenu(bar, "?", shelp);
    fMain.setMenuBar(bar);
    fMain.setSize(defWidth, defHeight);
    fMain.add("Center", this);
    initGUI();
    sRecent = new String[iMaxRecent];
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension size = fMain.getSize();
    // full size on screen with less than 640 width
    if (d.width > 640) {
        fMain.setLocation((d.width - size.width) / 2, (d.height - size.height) / 2);
    } else if (defWidth > 0 && defHeight > 0) {
        fMain.setLocation(defLocX, defLocY);
        fMain.setSize(defWidth, defHeight);
    } else {
        fMain.setLocation(0, 0);
        fMain.setSize(d);
    }
    fMain.show();
    // (ulrivo): load query from command line
    if (defQuery != null) {
        txtCommand.setText(DatabaseManagerCommon.readFile(defQuery));
    }
    txtCommand.requestFocus();
}
Also used : Frame(java.awt.Frame) MenuBar(java.awt.MenuBar) Menu(java.awt.Menu) Dimension(java.awt.Dimension) MemoryImageSource(java.awt.image.MemoryImageSource)

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