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

GridLayout with Panel containing Lists does not redraw correctly upon resize

    Details

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

      Description

      The following program shows that resizing this GridLayout does not redraw the Panel/Lists correctly. Actually, if you resize once its draws correctly, resize again, it does not draw correctly (removes the bottom border of the left List), resize again, draws correctly, ..., toggles between correct and incorrect drawing behaviour with each resize.

      Here is the layout of the frame:


      List 1 List2


      Label 1 TextField 1
      Label 2 TextField 2

      Button1 Button2

      GridLayout contains 3 Panels, with the middle Panel containing the 2 Lists.

      (In Xerox's application, using GridBagLayout has others issues so they would like to use GridLayout. Further, they say it used to work with JDK1.0.2)

      TestFrame.java
      --------------

      package GenEvent.Common;

      import java.awt.*;

      public class TestFrame extends Frame {

      public static void main(String args[]) {
      TestFrame cl = new TestFrame();
      cl.setVisible(true);
      }

      public TestFrame() {
      setTitle( "Grid Layout Problem Demo");
      Panel topPanel;

      setLayout(new BorderLayout());

      // Font myFont = new Font("Helvetica", Font.BOLD, 14);
      // setFont( myFont );



      topPanel = new Panel();
      topPanel.setLayout(new GridLayout( 1, 2));
      topPanel.add(new Label("Available Events:"));
      topPanel.add(new Label("Event Catalog:"));


      Panel listPanel = new Panel ();
      listPanel.setLayout( new GridLayout(1, 2, 1, 1) );
      List eventList = new List ( 50, false);
      for (int i=0; i<50;++i) eventList.addItem( "Xerox Event " + i);
      List catalogList = new List( 50, false);
      for (int i=0; i<50;++i) catalogList.addItem( "Xerox Catalog " + i);

      listPanel.add ( eventList );
      listPanel.add ( catalogList );


      Panel buttonPanel = new Panel();
      buttonPanel.add( new Button("OK"));
      buttonPanel.add( new Button("Cancel"));

      add("North",topPanel);
      add("Center",listPanel);
      add("South",buttonPanel);

      setSize(806,410);
      }

      }

        Attachments

          Activity

            People

            • Assignee:
              msomlosunw Mike Somlo (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: