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

JDK117[Solaris]: Adding/Removing a menu causes frame to unexpected small size

    Details

    • Subcomponent:
    • Resolved In Build:
      b01
    • CPU:
      sparc
    • OS:
      solaris_2.6
    • Verification:
      Verified

      Backports

        Description

        When adding a menu, the size of frame is changed correctly. (See Fig.B)
        And then if you remove a menu for a frame, the size of frame becomes wrong. (See Fig.C)
        It should be the size which was before adding it. In the figure below, Fig.A should be displayed.

          A B C
           ============ =========== =======
           | | ==> | menu | ==> -------
           | | -----------
           | | | |
           ------------ | |
                                | |
                                -----------

        It only happens on Solaris under the following environment.

        OS: Solaris 2.6 (EUC)
        HW: SPARC
        JDK: JDK117 build "D"

        OS: Solaris 2.6 (PCK)
        HW: X86
        JDK: JDK117 build "D"

        Windows95 and WindowsNT4.0 don't have this kind of problem.

        The same bug was reported in 1.1.1 and was fixed in 1.1.5 and was verified in 1.1.5 and 1.1.6.
        Please see 4028130.
        I can't see this bug in JDK1.1.6. So this is exactly a degrade from 1.1.6.
        Please fix this before FCS.

        Here is a code to reproduce:

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

        public class MenuTest implements ActionListener, WindowListener {
          Frame fp;
          MenuBar menu;
          Button bAgain, bNull;
          public static void main(String args[]) {
           new MenuTest().run(args);
          }

          void run(String args[]) {
            fp = new Frame();
            fp.addWindowListener(this);
            fp.add("West", bAgain = new Button("TRY:ADD"));
            fp.add("East", bNull = new Button("TRY:REMOVE"));
            bAgain.addActionListener(this);
            bNull.addActionListener(this);
            fp.pack();
            fp.show();
          }


          void quit() {
            fp.dispose();
            System.exit(0);
          }

          /* action listener */
          public void actionPerformed(ActionEvent e) {
            if(e.getSource() == bAgain) {
              menu = new MenuBar();
              menu.add(new Menu("BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
              menu.add(new Menu("BZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"));
              menu.add(new Menu("BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"));
            } else if(e.getSource() == bNull) {
              menu = null;
            }
            fp.setMenuBar(menu);
            System.out.println("Frame size:" + fp.getSize().toString());
            System.out.println("Button size:" + bAgain.getSize().toString());
          }

          /* WindowListener */
          public void windowOpened(WindowEvent e) {
            System.out.println("Frame size:" + fp.getSize().toString());
            System.out.println("Button size:" + bAgain.getSize().toString());
          }
          public void windowClosing(WindowEvent e) {
            quit();
          }
          public void windowClosed(WindowEvent e) {
          }
          public void windowIconified(WindowEvent e) {
          }
          public void windowDeiconified(WindowEvent e) {
          }
          public void windowActivated(WindowEvent e) {
          }
          public void windowDeactivated(WindowEvent e) {
          }
        }


          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  herrick Andy Herrick
                  Reporter:
                  duke J. Duke (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: