Java 类java.awt.MenuBar 实例源码

项目:OpenDiabetes    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:sstore-soft    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:s-store    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:dev-courses    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:parabuild-ci    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:parabuild-ci    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:parabuild-ci    文件:DatabaseManager.java   
/**
 * Method declaration
 *
 *
 * @param b
 * @param name
 * @param items
 */
void addMenu(MenuBar b, String name, String[] items) {

    /* It's a very poor design to encapsulate menu creation this way.
     * Can't customize the menus this way (e.g. shortcut keys,
     * mnemonics, disabling, etc. */
    Menu menu = new Menu(name);

    if (name.equals("Tools") && !TT_AVAILABLE) {

        // Terrible place to do this.  Forced to due to method design.
        menu.setEnabled(false);
    }

    addMenuItems(menu, items);
    b.add(menu);
}
项目:jdk8u-jdk    文件:CMenu.java   
@Override
long createModel() {
    CMenuComponent parent = (CMenuComponent)
        LWCToolkit.targetToPeer(getTarget().getParent());

    if (parent instanceof CMenu) {
        return parent.executeGet(this::nativeCreateSubMenu);
    }
    if (parent instanceof CMenuBar) {
        MenuBar parentContainer = (MenuBar)getTarget().getParent();
        boolean isHelpMenu = parentContainer.getHelpMenu() == getTarget();
        int insertionLocation = ((CMenuBar)parent).getNextInsertionIndex();
        return parent.executeGet(ptr -> nativeCreateMenu(ptr, isHelpMenu,
                                                         insertionLocation));
    }
    throw new InternalError("Parent must be CMenu or CMenuBar");
}
项目:jdk8u-jdk    文件:RemoveHelpMenu.java   
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
项目:openjdk-jdk10    文件:CMenu.java   
@Override
long createModel() {
    CMenuComponent parent = (CMenuComponent)
        LWCToolkit.targetToPeer(getTarget().getParent());

    if (parent instanceof CMenu) {
        return parent.executeGet(this::nativeCreateSubMenu);
    }
    if (parent instanceof CMenuBar) {
        MenuBar parentContainer = (MenuBar)getTarget().getParent();
        boolean isHelpMenu = parentContainer.getHelpMenu() == getTarget();
        int insertionLocation = ((CMenuBar)parent).getNextInsertionIndex();
        return parent.executeGet(ptr -> nativeCreateMenu(ptr, isHelpMenu,
                                                         insertionLocation));
    }
    throw new InternalError("Parent must be CMenu or CMenuBar");
}
项目:openjdk-jdk10    文件:RemoveHelpMenu.java   
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
项目:openjdk9    文件:RemoveHelpMenu.java   
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
项目:jdk8u_jdk    文件:CMenu.java   
@Override
long createModel() {
    CMenuComponent parent = (CMenuComponent)
        LWCToolkit.targetToPeer(getTarget().getParent());

    if (parent instanceof CMenu) {
        return parent.executeGet(this::nativeCreateSubMenu);
    }
    if (parent instanceof CMenuBar) {
        MenuBar parentContainer = (MenuBar)getTarget().getParent();
        boolean isHelpMenu = parentContainer.getHelpMenu() == getTarget();
        int insertionLocation = ((CMenuBar)parent).getNextInsertionIndex();
        return parent.executeGet(ptr -> nativeCreateMenu(ptr, isHelpMenu,
                                                         insertionLocation));
    }
    throw new InternalError("Parent must be CMenu or CMenuBar");
}
项目:jdk8u_jdk    文件:RemoveHelpMenu.java   
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
项目:lookaside_java-1.8.0-openjdk    文件:CMenu.java   
@Override
long createModel() {
    CMenuComponent parent = (CMenuComponent)
        LWCToolkit.targetToPeer(getTarget().getParent());

    if (parent instanceof CMenu) {
        return parent.executeGet(this::nativeCreateSubMenu);
    }
    if (parent instanceof CMenuBar) {
        MenuBar parentContainer = (MenuBar)getTarget().getParent();
        boolean isHelpMenu = parentContainer.getHelpMenu() == getTarget();
        int insertionLocation = ((CMenuBar)parent).getNextInsertionIndex();
        return parent.executeGet(ptr -> nativeCreateMenu(ptr, isHelpMenu,
                                                         insertionLocation));
    }
    throw new InternalError("Parent must be CMenu or CMenuBar");
}
项目:lookaside_java-1.8.0-openjdk    文件:RemoveHelpMenu.java   
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
项目:javify    文件:GtkMenuBarPeer.java   
/**
 * Adds a help menu to this MenuBar. Gnome styleguides say the help
 * menu is just the last item in the menubar (they are NOT right
 * justified).
 */
public void addHelpMenu (Menu menu)
{
  if (hasHelpMenu)
    {
      // Remove the (help) menu, which is after all the other items.
      delMenu(((MenuBar) awtWidget).getMenuCount());
      hasHelpMenu = false;
    }

  if (menu != null)
    {
      addMenu(menu);
      hasHelpMenu = true;
    }
}
项目:javify    文件:QtFramePeer.java   
public void setMenuBar(MenuBar mb)
{
  if( mb != null )
    {
      QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer();
      if( mbpeer == null )
        {
          mb.addNotify();
          mbpeer = (QtMenuBarPeer)mb.getPeer();
          if( mbpeer == null )
            throw new IllegalStateException("No menu bar peer.");
        }
      mbpeer.addMenus();
      setMenu( mbpeer );
    }
  else
    setMenu( null );
}
项目:jvm-stm    文件:GtkMenuBarPeer.java   
/**
 * Adds a help menu to this MenuBar. Gnome styleguides say the help
 * menu is just the last item in the menubar (they are NOT right
 * justified).
 */
public void addHelpMenu (Menu menu)
{
  if (hasHelpMenu)
    {
      // Remove the (help) menu, which is after all the other items.
      delMenu(((MenuBar) awtWidget).getMenuCount());
      hasHelpMenu = false;
    }

  if (menu != null)
    {
      addMenu(menu);
      hasHelpMenu = true;
    }
}
项目:jvm-stm    文件:QtFramePeer.java   
public void setMenuBar(MenuBar mb)
 {
   if( mb != null )
     {
QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer();
if( mbpeer == null )
  {
    mb.addNotify();
    mbpeer = (QtMenuBarPeer)mb.getPeer();
    if( mbpeer == null )
      throw new IllegalStateException("No menu bar peer.");
  }
mbpeer.addMenus();
setMenu( mbpeer );
     } 
   else
     setMenu( null );
 }
项目:VoltDB    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:Pegasus    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:JamVM-PH    文件:GtkMenuBarPeer.java   
/**
 * Adds a help menu to this MenuBar. Gnome styleguides say the help
 * menu is just the last item in the menubar (they are NOT right
 * justified).
 */
public void addHelpMenu (Menu menu)
{
  if (hasHelpMenu)
    {
      // Remove the (help) menu, which is after all the other items.
      delMenu(((MenuBar) awtWidget).getMenuCount());
      hasHelpMenu = false;
    }

  if (menu != null)
    {
      addMenu(menu);
      hasHelpMenu = true;
    }
}
项目:JamVM-PH    文件:QtFramePeer.java   
public void setMenuBar(MenuBar mb)
 {
   if( mb != null )
     {
QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer();
if( mbpeer == null )
  {
    mb.addNotify();
    mbpeer = (QtMenuBarPeer)mb.getPeer();
    if( mbpeer == null )
      throw new IllegalStateException("No menu bar peer.");
  }
mbpeer.addMenus();
setMenu( mbpeer );
     } 
   else
     setMenu( null );
 }
项目:classpath    文件:GtkMenuBarPeer.java   
/**
 * Adds a help menu to this MenuBar. Gnome styleguides say the help
 * menu is just the last item in the menubar (they are NOT right
 * justified).
 */
public void addHelpMenu (Menu menu)
{
  if (hasHelpMenu)
    {
      // Remove the (help) menu, which is after all the other items.
      delMenu(((MenuBar) awtWidget).getMenuCount());
      hasHelpMenu = false;
    }

  if (menu != null)
    {
      addMenu(menu);
      hasHelpMenu = true;
    }
}
项目:classpath    文件:QtFramePeer.java   
public void setMenuBar(MenuBar mb)
{
  if( mb != null )
    {
      QtMenuBarPeer mbpeer = (QtMenuBarPeer)mb.getPeer();
      if( mbpeer == null )
        {
          mb.addNotify();
          mbpeer = (QtMenuBarPeer)mb.getPeer();
          if( mbpeer == null )
            throw new IllegalStateException("No menu bar peer.");
        }
      mbpeer.addMenus();
      setMenu( mbpeer );
    }
  else
    setMenu( null );
}
项目:Mobile-Network-LTE    文件:DatabaseManager.java   
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
项目:jago    文件:OpenPartnerFrame.java   
public OpenPartnerFrame (Go go)
{
    super(Global.resourceString("Open_Partners"));
    G = go;
    MenuBar mb = new MenuBar();
    setMenuBar(mb);
    Menu m = new MyMenu(Global.resourceString("Options"));
    m.add(new MenuItemAction(this, Global.resourceString("Close")));
    mb.add(m);
    setLayout(new BorderLayout());
    L = new java.awt.List();
    L.setFont(Global.SansSerif);
    refresh();
    add("Center", L);
    JPanel bp = new MyPanel();
    bp.add(new ButtonAction(this, Global.resourceString("Connect")));
    bp.add(new ButtonAction(this, Global.resourceString("Refresh")));
    bp.add(new MyLabel(" "));
    bp.add(new ButtonAction(this, Global.resourceString("Close")));
    add("South", bp);
    Global.setwindow(this, "openpartner", 300, 200);
    seticon("ijago.gif");
    setVisible(true);
    OPFU = new OpenPartnerFrameUpdate(this);
}
项目:OpenJSharp    文件:XFramePeer.java   
public void setMenuBar(MenuBar mb) {
    // state_lock should always be the second after awt_lock
    XToolkit.awtLock();
    try {
        synchronized(getStateLock()) {
            if (mb == menubar) return;
            if (mb == null) {
                if (menubar != null) {
                    menubarPeer.xSetVisible(false);
                    menubar = null;
                    menubarPeer.dispose();
                    menubarPeer = null;
                }
            } else {
                menubar = mb;
                menubarPeer = (XMenuBarPeer) mb.getPeer();
                if (menubarPeer != null) {
                    menubarPeer.init((Frame)target);
                }
            }
        }
    } finally {
        XToolkit.awtUnlock();
    }

    reshapeMenubarPeer();
}
项目:parabuild-ci    文件:QueryTool.java   
/**
 * Method declaration
 *
 *
 * @param arg
 */
public static void main(String arg[]) {

    fMain = new Frame("Query Tool");

    QueryTool q = new QueryTool();

    q.bApplication = true;

    for (int i = 0; i < arg.length; i++) {
        String p = arg[i];

        if (p.equals("-?")) {
            printHelp();
        }

        if (p.charAt(0) == '-') {
            pProperties.put(p.substring(1), arg[i + 1]);

            i++;
        }
    }

    q.init();
    q.start();
    fMain.add("Center", q);

    MenuBar menu = new MenuBar();
    Menu    file = new Menu("File");

    file.add("Exit");
    file.addActionListener(q);
    menu.add(file);
    fMain.setMenuBar(menu);
    fMain.setSize(500, 400);
    fMain.show();
    fMain.addWindowListener(q);
}
项目:parabuild-ci    文件:QueryTool.java   
/**
 * Method declaration
 *
 *
 * @param arg
 */
public static void main(String[] arg) {

    fMain = new Frame("Query Tool");

    QueryTool q = new QueryTool();

    q.bApplication = true;

    for (int i = 0; i < arg.length; i++) {
        String p = arg[i];

        if (p.equals("-?")) {
            printHelp();
        }

        if (p.charAt(0) == '-') {
            pProperties.put(p.substring(1), arg[i + 1]);

            i++;
        }
    }

    q.init();
    q.start();
    fMain.add("Center", q);

    MenuBar menu = new MenuBar();
    Menu    file = new Menu("File");

    file.add("Exit");
    file.addActionListener(q);
    menu.add(file);
    fMain.setMenuBar(menu);
    fMain.setSize(500, 400);
    fMain.show();
    fMain.addWindowListener(q);
}
项目:parabuild-ci    文件:QueryTool.java   
/**
 * Method declaration
 *
 *
 * @param arg
 */
public static void main(String[] arg) {

    fMain = new Frame("Query Tool");

    QueryTool q = new QueryTool();

    q.bApplication = true;

    for (int i = 0; i < arg.length; i++) {
        String p = arg[i];

        if (p.equals("-?")) {
            printHelp();
        }

        if (p.charAt(0) == '-') {
            pProperties.put(p.substring(1), arg[i + 1]);

            i++;
        }
    }

    q.init();
    q.start();
    fMain.add("Center", q);

    MenuBar menu = new MenuBar();
    Menu    file = new Menu("File");

    file.add("Exit");
    file.addActionListener(q);
    menu.add(file);
    fMain.setMenuBar(menu);
    fMain.setSize(500, 400);
    fMain.show();
    fMain.addWindowListener(q);
}
项目:parabuild-ci    文件:QueryTool.java   
/**
 * Method declaration
 *
 *
 * @param arg
 */
public static void main(String[] arg) {

    fMain = new Frame("Query Tool");

    QueryTool q = new QueryTool();

    q.bApplication = true;

    for (int i = 0; i < arg.length; i++) {
        String p = arg[i];

        if (p.equals("-?")) {
            printHelp();
        }

        if (p.charAt(0) == '-') {
            pProperties.put(p.substring(1), arg[i + 1]);

            i++;
        }
    }

    q.init();
    q.start();
    fMain.add("Center", q);

    MenuBar menu = new MenuBar();
    Menu    file = new Menu("File");

    file.add("Exit");
    file.addActionListener(q);
    menu.add(file);
    fMain.setMenuBar(menu);
    fMain.setSize(500, 400);
    fMain.show();
    fMain.addWindowListener(q);
}
项目:jdk8u-jdk    文件:XFramePeer.java   
public void setMenuBar(MenuBar mb) {
    // state_lock should always be the second after awt_lock
    XToolkit.awtLock();
    try {
        synchronized(getStateLock()) {
            if (mb == menubar) return;
            if (mb == null) {
                if (menubar != null) {
                    menubarPeer.xSetVisible(false);
                    menubar = null;
                    menubarPeer.dispose();
                    menubarPeer = null;
                }
            } else {
                menubar = mb;
                menubarPeer = (XMenuBarPeer) mb.getPeer();
                if (menubarPeer != null) {
                    menubarPeer.init((Frame)target);
                }
            }
        }
    } finally {
        XToolkit.awtUnlock();
    }

    reshapeMenubarPeer();
}
项目:jdk8u-jdk    文件:RemoveHelpMenu.java   
private static void test2(final MenuBar menuBar) {
    final Menu helpMenu = new Menu("Help Menu");
    menuBar.setHelpMenu(helpMenu);
    checkCurrentMenu(menuBar, helpMenu);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu, true);

    menuBar.remove(helpMenu);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu, false);
}
项目:jdk8u-jdk    文件:RemoveHelpMenu.java   
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);
}
项目:openjdk-jdk10    文件:XFramePeer.java   
@SuppressWarnings("deprecation")
public void setMenuBar(MenuBar mb) {
    // state_lock should always be the second after awt_lock
    XToolkit.awtLock();
    try {
        synchronized(getStateLock()) {
            if (mb == menubar) return;
            if (mb == null) {
                if (menubar != null) {
                    menubarPeer.xSetVisible(false);
                    menubar = null;
                    menubarPeer.dispose();
                    menubarPeer = null;
                }
            } else {
                menubar = mb;
                menubarPeer = AWTAccessor.getMenuComponentAccessor()
                                         .getPeer(mb);
                if (menubarPeer != null) {
                    menubarPeer.init((Frame)target);
                }
            }
        }
    } finally {
        XToolkit.awtUnlock();
    }

    reshapeMenubarPeer();
}
项目:openjdk-jdk10    文件:RemoveHelpMenu.java   
private static void test2(final MenuBar menuBar) {
    final Menu helpMenu = new Menu("Help Menu");
    menuBar.setHelpMenu(helpMenu);
    checkCurrentMenu(menuBar, helpMenu);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu, true);

    menuBar.remove(helpMenu);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu, false);
}
项目:openjdk-jdk10    文件:RemoveHelpMenu.java   
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);
}
项目:openjdk-jdk10    文件:ActionEventTest.java   
public ActionEventTest() {
    menuBar = new MenuBar();
    Menu menu = new Menu("Menu1");
    MenuItem menuItem = new MenuItem("MenuItem");

    menuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            System.out.println("actionPerformed");
            int md = ae.getModifiers();
            int expectedMask = ActionEvent.ALT_MASK | ActionEvent.CTRL_MASK
                    | ActionEvent.SHIFT_MASK;

            isProgInterruption = true;
            mainThread.interrupt();
            if ((md & expectedMask) != expectedMask) {
                throw new RuntimeException("Action Event modifiers are not"
                    + " set correctly.");
            }
        }
    });
    menu.add(menuItem);
    menuBar.add(menu);
    setMenuBar(menuBar);

    instructions = new TextArea(10, 50);
    instructions.setText(
    " This is a manual test\n" +
    " Keep the Alt, Shift & Ctrl Keys pressed while doing next steps\n" +
    " Click 'Menu1' Menu from the Menu Bar\n" +
    " It will show 'MenuItem'\n" +
    " Left mouse Click the 'MenuItem'\n" +
    " Test exits automatically after mouse click.");
    add(instructions);

    setSize(400, 400);
    setVisible(true);
    validate();
}