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

Menu items can be lost

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 2.1, 1.1.1, 1.1.6
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      other, solaris_2.6, windows_nt

      Description

      The following code demonstrates a problem with displaying large menus.

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


      public class MenuTest extends Frame {
      MenuBar menuTest;

          public MenuTest() {
      super();
      setSize(200,200);
      this.addWindowListener(new WindowAdapter() { // begin anon
      public void windowClosing(WindowEvent e) {
      System.exit(0);
      } // windowClosing
      } ); // end anon
      menuTest = createMenuBar();

          }
      // basic instantiation
          
          public static void main(String argv[]) {
      MenuTest testFrame = new MenuTest();
      testFrame.setMenuBar(testFrame.menuTest);
      testFrame.setVisible(true);
      }

          MenuBar createMenuBar() {
      // MenuBar
      MenuBar menuBar = new MenuBar();

      MenuItem mi;

      // File Menu
      Menu file = (Menu) menuBar.add(new Menu("File"));
              mi = (MenuItem) file.add(new MenuItem("About"));
              mi = (MenuItem) file.add(new MenuItem("Open"));
      mi.setEnabled(false);
              mi = (MenuItem) file.add(new MenuItem("Save"));
      mi.setEnabled(false);
              mi = (MenuItem) file.add(new MenuItem("Save As..."));
      mi.setEnabled(false);
              
              mi = (MenuItem) file.add(new MenuItem("Exit"));
              
      mi.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      System.exit(0);
      }
      });


      // Options Menu
      Menu options = (Menu) menuBar.add(new Menu("100 Items"));
      for (int i = 1; i<100; i++)
      {
      mi = (MenuItem) options.add(new MenuItem("choice " + i));
      }


      return menuBar;
          }

      }

      Added by nick.rodin@eng, 1998-10-19:

      I have tested this example with 1.1.6, 1.1.7, and 1.2 with the same results.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              son Oleg Sukhodolsky (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: