Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4275843

MenuBar doesn't display all of its Menus correctly on Windows

XMLWordPrintable

    • kestrel
    • x86
    • windows_98
    • Verified

      The AWT's MenuBar doesn't display all of its Menu correctly on Windows.
      As demonstrated in the following program which should display:

      ________________________________________________________________
      | one | two | three | Help2 | four | |
      |_____|_____|_______|_______|______|___________________________|

      On Windows the MenuBar only shows:

      ________________________________________________________________
      | one | two | three | |
      |_____|_____|_______|__________________________________________|


      The "Help2" and "four" didn't show up on its slot but if you slide the
      cursor over it and click on it, then there's a pulled down menu.

      ------------------------------------------------------------------------
      import java.awt.*;
      import java.awt.event.*;

      public class menuBar1 extends Frame {
          public static void main(String argv[] ) {
              menuBar1 m = new menuBar1();
          }

          public menuBar1 () {
      setTitle("Test Frame");

      show();
      setSize(400, 200);

      addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent we) {
      System.exit(0);
      }
      });

      MenuBar mb = new MenuBar();
      Menu h1, h2;

      setMenuBar(mb);
      mb.add(createMenu("one", false));
      mb.add(createMenu("two", false));
      mb.add(createMenu("three", true));

      mb.add(h1 = createMenu("Help 1", false)); // h1 is HelpMenu
      mb.setHelpMenu(h1);
      mb.add(h2 = createMenu("Help 2", false)); // h2 replaced h1
      mb.setHelpMenu(h2);
      mb.add(createMenu("four", false));

      System.out.println(mb.getHelpMenu());
      System.out.println(mb.getMenuCount());

          }

          Menu createMenu(String name, boolean tearoff) {
      Menu m = new Menu(name, tearoff);
      m.add(new MenuItem(name + " item 1"));
      m.add(new MenuItem(name + " item 2"));
      m.add(new MenuItem(name + " item 3"));
      return m;
          }

      }
      ------------------------------------------------------------------------
      Roger Pham 9/27/99

            svnguyen Son Nguyen
            rphamsunw Roger Pham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: