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

XAWT: Help menu overlaps other menus

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b35
    • CPU:
      generic
    • OS:
      generic

      Description

      Under XAWT, when there are more menus than can fit in a MenuBar AND there is a Help menu at the right hand side, the Help menu overlaps the other Menus. This looks bad.

      Under MAWT, when there are too many menus, the Help menu is no longer displayed. This looks better, and has been the behavior since (at least) 1.1.8.

      XAWT should behave the same as MAWT and hide the Help menu under these circumstances.
      I used the following test case. Just press the "Add Menu" button until you fill up the MenuBar.

      // test Menu.setHelpMenu()

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

      public class HelpMenu implements ActionListener {
          static MenuBar mb;
          static HelpMenu hm;
          static Button addMenu;
          static Button addHelp;
          public static void main(String[] args) {
              hm = new HelpMenu();
              Frame f = new Frame("HelpMenu");
              f.setSize(600, 200);
              mb = new MenuBar();

              mb.add(createNewMenu());
              mb.setHelpMenu(createNewHelpMenu());
              mb.add(createNewMenu());
              f.setMenuBar(mb);

              f.setLayout(new FlowLayout());

              addMenu = new Button("Add Menu");
              addMenu.addActionListener(hm);
              f.add(addMenu);

              addHelp = new Button("Set New Help Menu");
              addHelp.addActionListener(hm);
              f.add(addHelp);

              f.setVisible(true);
          }

          public void actionPerformed(ActionEvent e) {
              if (e.getSource() == addMenu) {
                  mb.add(createNewMenu());
              }
              else if (e.getSource() == addHelp) {
                  mb.setHelpMenu(createNewHelpMenu());
              }
          }

          private static int menuNum = 0;
          public static Menu createNewHelpMenu() {
              menuNum++;
              Menu helpMenu = new Menu("HelpMenu " + menuNum);
              helpMenu.add("Help Item " + menuNum);
              helpMenu.add("Help Item " + menuNum);
              return helpMenu;
          }
          public static Menu createNewMenu() {
              Menu menu = new Menu("Menu");
              menu.add("Item 1");
              menu.add("Item 2");
              return menu;
          }
      }

      This was files as part of 4958729.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mbronsonsunw Mike Bronson (Inactive)
              Reporter:
              bchristi Brent Christian
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: