-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
7
-
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);
}
}
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);
}
}
- duplicates
-
JDK-6682046 Mixing code does not always recalculate shapes correctly when resizing components
- Resolved