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

problem with GridLayout nested as "south" component in BorderLayout

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: rm29839 Date: 03/10/98


      I produced this bug using both JDK 1.1.3 on Linux and JDK 1.2beta2 on Solaris Sparc. I am using Swing 1.0 with both.
      Test code appears below.

      The GridLayout appears much too big, taking up
      more than the whole frame, so that only the
      bottom part of the GridLayout appears.

      If you reverse the SOUTH and CENTER in the code below,
      so that the GridLayout appears in the center of the
      BorderLayout, then everything works fine.

      import java.awt.*;
      import com.sun.java.swing.*;

      class Test {
        static final String[] array = { "A","B","C","D","E","F","G","H","I","J","K","L","M","N" };
        static public void main(String argv[])
          throws Exception {
          JFrame frame = new JFrame("Test");
          Container cp = frame.getContentPane();
          JPanel jp = new JPanel();

          jp.setLayout(new GridLayout(0,1));
          for(int i=0; i<array.length; i++)
            jp.add(new JRadioButton(array[i]));
          cp.add(jp, BorderLayout.SOUTH);
          cp.add(new JButton("testing"), BorderLayout.CENTER);
          cp.add(new JButton("foobar"), BorderLayout.NORTH);
          frame.setSize(100, 200);
          frame.setVisible(true);
        }
      }
      (Review ID: 26057)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            jmelvin James Melvin (Inactive)
            Reporter:
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: