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

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

XMLWordPrintable

    • x86
    • windows_98

      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 running jdk1.3versionO shows :

      _____________________________________________________________
      | one | two | three | | | | |
      |_____|_____|_______|_______|______|______|_________________|

      Sliding the mouse over the 1st blank spot and click I got the
      cascaded submenu of the Help2. On the 2nd blank spot I got
      the Help2 menu and on the 3rd I got the four menu.

      Running with jdk1.2fcs shows :

      _____________________________________________________________
      | one | two | three | | Help2 | four | |
      |_____|_____|_______|_______|_______|______|________________|

      The result here is a little better but like the previous run
      the most confusing thing is clicking on the first blank spot
      I got the cascaded submenu of the Help2 menu which can be
      very confusing user interface.

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

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

          public menuBar3 () {
      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;
      Menu sm = createMenu("Submenu");

      setMenuBar(mb);
      mb.add(createMenu("one"));
      mb.add(createMenu("two"));
      mb.add(createMenu("three"));
      mb.add(h1 = createMenu("Help1"));
      mb.setHelpMenu(h1);
      mb.add(h2 = createMenu("Help2")); // h2 is the HelpMenu
      mb.setHelpMenu(h2);
      h2.add(sm);
      mb.add(createMenu("four"));


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

          }

          Menu createMenu(String name) {
      Menu m = new Menu(name);
      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

      Red status tag removed, Roger Pham 11/2/99

            tdv Dmitri Trembovetski (Inactive)
            rphamsunw Roger Pham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: