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

setMenuBar() causes Frame to resize and flicker

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description



      Name: moC74494 Date: 05/14/98


      - create Frame
      - create Menus and MenuBar
      - frame.setMenuBar( menuBar )
      - frame.add( somePanel or components )
      - frame.pack()
      - frame.show()
      ...
      - create a different set of Menus and MenuBar
      - frame.setMenuBar( aDifferentMenuBar )

      the window flashes twice and then resizes to
      fit only the new menu bar, ignoring the previous
      Frame size and its component preferredSizes.

      Using setMenuBar() the first time (ie. on initial
      creation of the Frame) works fine.

      Removing menus from the menu bar using
      MenuBar.remove() does the same thing. Adding
      menus on the fly seems ok.

      mircea@canada 05/14/98 - modified test from bug 4028130

      import java.awt.*;
       
      public class Garcon extends Frame {

        MenuBar bar1, bar2;
        boolean f = false;

          Garcon() {
              bar1 = new MenuBar();
              bar1.add(new Menu("foo"));

              bar2 = new MenuBar();
              bar2.add(new Menu("foo"));
              bar2.add(new Menu("bar"));

              resize(200,200);
              setMenuBar(bar1);
              show();
          }
       
          public boolean handleEvent(Event evt) {
              if (evt.id == Event.MOUSE_UP) {
      if (f == false) {
                  setMenuBar(bar2);
      f = true;
      } else {
      setMenuBar(bar1);
      f = false;
      }
              }
              return false;
          }
       
          public static void main(String argv[]) {
              new Garcon();
          }
      }
       

      (Review ID: 24118)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            kdmsunw Kdm Kdm (Inactive)
            Reporter:
            moanceasunw Mircea Oancea (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: