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

Increasing the size of a window makes a component clipped

XMLWordPrintable

    • x86
    • windows_xp

      This is reproducible with jdk7 b27 PIT build. Observed it on Windows XP professional. This is not reproducible with 6u10 b23.

      Run the below test. Increase the height of the Frame by dragging down at the bottom border. As the size of the window increases, it could be seen that the list present in the window becomes clipped.

      import java.awt.*;
      import java.awt.event.*;
      import java.util.StringTokenizer;

      public class FrameResizeTest {
          
          public static void main(String[] args) {
              Frame f = new Frame();
              f.setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              gbc.gridwidth = GridBagConstraints.REMAINDER;

              Panel p = new Panel();
              p.setLayout(new BorderLayout());
              Panel tp = new Panel();
              tp.setLayout(new GridBagLayout());
              List list = new List();
              for (int i = 0; i < 10; i++) {
                  list.add("Item" + i);
              }
              tp.add(list, gbc);
              p.add(tp);
              
              gbc.fill = GridBagConstraints.BOTH;
              gbc.weightx = 1;
              gbc.weighty = 0;

              f.add(new Label("A label at North"), gbc);
              gbc.weighty = 4;
              f.add(p, gbc);
              gbc.weighty = 0;
              Panel bp = new Panel();
              bp.add(new Label("A label at South"));
              f.add(bp, gbc);
              f.setSize(400, 200);
              f.setVisible(true);
          }
      }

            anthony Anthony Petrov (Inactive)
            gramachasunw Girish Ramachandran (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: