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

win95 only: menus can not be added to menuBar properly

XMLWordPrintable

    • x86
    • windows_nt

      Under Windows 95, and attempt to add
      additional menu items to a MenuBar once
      the MenuBar's peer has been created leads to
      weird behavior; the menubar adds
      each item south of the menubar, increasing
      the menubar's height for each added
      menu item. These misplaced menu items are
      invisible (though they respond to
      mouse clicks). This bug forces us to either
      a) destroy the menubar and rebuild
      it everytime it is to change (resulting in
      mucho flicker - sound familiar), or
      b) attempt to write our own version of the
      menubar (we're already trying this -
      but the result is buggy).
      >
      > This bug does not exist under Solaris
      HotJava 1.0 runtime.
      >
      > If you have any questions or require
      further details please do not hesitate
      to contact me at any time. I can be reached
      via phone at (613) 728-0826
      ext.1581 or via e-mail at ###@###.###.
      >
      > Frank Scheffer
      > Lead QA - New Technologies
      > Corel Corporation
      >
      >


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

      public class MenuTest extends Frame
      {
          private Frame frame=this;

          public MenuTest()
          {
              MenuBar menuBar=new MenuBar();
              Menu fileMenu=new Menu("File");
              CheckboxMenuItem testBoxMenu=new CheckboxMenuItem("Test");
              Button addMenuButton=new Button("Add a menu!");

              testBoxMenu.addActionListener(new ActionListener()
                                              {
                                                  public void actionPerformed(ActionEvent e)
                                                  {
                                                      System.out.println("ActionClick!");
                                                  }
                                              });

              testBoxMenu.addItemListener(new ItemListener()
                                              {
                                                  public void itemStateChanged(ItemEvent e)
                                                  {
                                                      System.out.println("ItemClick!");
                                                  }
                                              });

              fileMenu.add(testBoxMenu);
              menuBar.add(fileMenu);
              setMenuBar(menuBar);
              addMenuButton.addActionListener(new ActionListener()
                                              {
                                                  public void actionPerformed(ActionEvent e)
                                                  {
                                                      Menu newMenu=new Menu("Test");
                                                      MenuItem newMenuItem=new MenuItem("Men
      u Item Test");

                                                      newMenu.add(newMenuItem);
                                                      frame.getMenuBar().add(newMenu);
                                                  }
                                              });
              add(addMenuButton,"Center");
              pack();
              resize(200,200);
              show();
          }

          public static void main(String args[])
          {
              MenuTest mt=new MenuTest();
          }
      }

            cchongsunw Creighton Chong (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: