In Solaris, when JMenu is larger than container, its items can not be shown.

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P4
    • None
    • Affects Version/s: 1.2.0
    • Component/s: client-libs

      JDK Version: 1.2beta4-F
      Locale: zh
      OS: Solaris

      When JMenu's List be larger than the JFrame, and you popup the menu twice, the
      second time, the menu has a refresh problem.
      Following is a program to reproduce it.

      ===========================CheckJMenu.java====================================
      import java.awt.swing.*;
      import java.awt.swing.border.*;
      import java.awt.*;
      import java.util.*;
      import java.io.*;

      public class CheckJMenu extends JScrollPane {
          JMenuBar mainBar;
          JGeneralMenu myMenu1;

          public static void main(String args[]) {
      JFrame f = new JFrame("JMenu Panel");
      f.getContentPane().setLayout(new BorderLayout());
      f.getContentPane().add(new CheckJMenu(), BorderLayout.CENTER);
      f.pack();
      f.show();
          }

          public CheckJMenu() {
              JPanel p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
      Font boldFont = new Font("Dialog", Font.BOLD, 12);
      p.setBorder(new EmptyBorder(10, 10, 10, 10));

      JLabel label = new JLabel("Menus:");
      label.setAlignmentX(LEFT_ALIGNMENT);
      label.setAlignmentY(TOP_ALIGNMENT);
      p.add(label);
      p.add(Box.createRigidArea(new Dimension(1, 40)));
      mainBar = new JMenuBar();
      //mainBar.setAlignmentX(LEFT_ALIGNMENT);
      mainBar.setAlignmentY(TOP_ALIGNMENT);
      label.setLabelFor(mainBar);

      myMenu1 = new JGeneralMenu("General Menu");

      mainBar.add(myMenu1);

      p.add(mainBar);
      getViewport().add(p);


          }

      }
      ==============================================================================

      ==========================JGeneralMenu.java===================================

      import java.awt.swing.*;
      import java.awt.*;
      import java.util.*;

      public class JGeneralMenu extends JMenu {
          JMenuItem myJMenuItem1;
          JMenuItem myJMenuItem2;
          JMenuItem myJMenuItem3;
          JMenuItem myJMenuItem4;
          int itemCount = 4;

          public JGeneralMenu(String name) {
      super(name);
      myJMenuItem1 = new JMenuItem("General Menu Item 1");
      myJMenuItem2 = new JMenuItem("General Menu Item 2");
      myJMenuItem3 = new JMenuItem("General Menu Item 3");
      myJMenuItem4 = new JMenuItem("General Menu Item 4");

      add(myJMenuItem1);
      add(myJMenuItem2);
      add(myJMenuItem3);
      add(myJMenuItem4);

          }

      }

      =============================================================================
      save these two files.
      javac CheckJMenu.java
      java CheckJMenu
      use mouse to popup the menu twice
      the second time, the menu items can not be shown.



      jim.hu@prc 1998-05-19

            Assignee:
            Georges Saab
            Reporter:
            Jim Hu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: