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

setHelpMenu() works only once on the same MenuBar.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P4
    • None
    • 1.1.2, 1.1.8, 1.2.2, 1.3.0
    • client-libs
    • x86, sparc
    • solaris_2.5.1, solaris_7, windows_nt

    Description



      Name: joT67522 Date: 08/22/97


      1. The source code should be self explaining:


      // File: HelpMenu.java
      //
      // setHelpMenu only works for the first time, it is called. Any
      // subsequent call shows the menu at a wrong position on the MenuBar.
      import java.awt.*;
      import java.awt.event.*;

      public class HelpMenu extends Frame implements ActionListener {
              public static void main(String[] args) {
                      HelpMenu helpMenu = new HelpMenu();
                      helpMenu.show();
              }

              public HelpMenu() {
                      MenuBar mb = new MenuBar();

                      Menu m = new Menu("File");
                      mb.add(m);

                      m = new Menu("Help");
                      mb.setHelpMenu(m);

                      setMenuBar(mb);

                      setBounds(100, 100, 200, 200);

                      Button b = new Button("Test bug");
                      b.addActionListener(this);
                      add(b);
              }

              public void actionPerformed(ActionEvent e) {
                      if (e.getActionCommand().equals("Test bug")) {
                              Menu m = new Menu("Help");
                              getMenuBar().setHelpMenu(m);
                      }
              }
      }
      company - TS Softwareentwicklung , email - ###@###.###
      ======================================================================

      I have a MenuBar with 3 Menu's.
      1. File // added with add(Menu m)
      2. Edit // added with add(Menu m)
      3. Help // added with setHelpMenu(Menu m)

      Now I want to add one new Menu, after Edit
      and before Help. How can I do that, do I have
      to:
       remove(helpMenu);
       add(newMenu);
       setHelpMenu(helpMenu);

      If I only do "add(newMenu);", then the menubar
      adds the new Menu behind the HelpMenu. I
      exspected that the HelpMenu is a special one
      and has it's position always at the end of the
      menubar. Is this a bug or did I exspect the
      wrong functioning of the helpmenu ?

      Frank

      Attachments

        Issue Links

          Activity

            People

              ibdsunw Ibd Ibd (Inactive)
              johsunw Joon Oh (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: