-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.3.1_06, 1.4.1, 1.4.1_02, 1.4.2
-
x86
-
windows_2000
Name: jk109818 Date: 05/15/2003
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
When I resize a JScrollPane inside GridBagLayout to be larger, the scrollbars vanish as expected but the space for the scrollbars remains. (The space vanishes on the second resize).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the attached source code. A frame will appear, containing a JScrollPane which contains a JList. Vertical scrollbars will be present.
2. Increase the height of the frame by an inch.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The vertical scrollbar should disappear and the JScrollPane should shrink horizontally so that there is no empty space where the vertical scrollbar was.
ACTUAL -
There is empty space where the vertical scrollbar was. (But if you resize the frame again slightly, the empty space vanishes).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class TestFrame extends JFrame {
private GridBagLayout gridBagLayout1 = new GridBagLayout();
private JScrollPane jScrollPane1 = new JScrollPane();
private JList jList1 = new JList();
private Vector items() {
Vector items = new Vector();
for (int i = 0; i < 10; i++) {
items.add("foobar");
}
return items;
}
public TestFrame() {
jList1 = new JList(items());
try {
this.getContentPane().setLayout(gridBagLayout1);
this.getContentPane().add(
jScrollPane1,
new GridBagConstraints(
0,
0,
1,
1,
0.0,
1.0,
GridBagConstraints.CENTER,
GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0),
0,
0));
jScrollPane1.getViewport().add(jList1, null);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
final TestFrame testFrame = new TestFrame();
testFrame.setSize(200, 200);
testFrame.setVisible(true);
}
}
---------- END SOURCE ----------
(Review ID: 185722)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
When I resize a JScrollPane inside GridBagLayout to be larger, the scrollbars vanish as expected but the space for the scrollbars remains. (The space vanishes on the second resize).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the attached source code. A frame will appear, containing a JScrollPane which contains a JList. Vertical scrollbars will be present.
2. Increase the height of the frame by an inch.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The vertical scrollbar should disappear and the JScrollPane should shrink horizontally so that there is no empty space where the vertical scrollbar was.
ACTUAL -
There is empty space where the vertical scrollbar was. (But if you resize the frame again slightly, the empty space vanishes).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class TestFrame extends JFrame {
private GridBagLayout gridBagLayout1 = new GridBagLayout();
private JScrollPane jScrollPane1 = new JScrollPane();
private JList jList1 = new JList();
private Vector items() {
Vector items = new Vector();
for (int i = 0; i < 10; i++) {
items.add("foobar");
}
return items;
}
public TestFrame() {
jList1 = new JList(items());
try {
this.getContentPane().setLayout(gridBagLayout1);
this.getContentPane().add(
jScrollPane1,
new GridBagConstraints(
0,
0,
1,
1,
0.0,
1.0,
GridBagConstraints.CENTER,
GridBagConstraints.BOTH,
new Insets(0, 0, 0, 0),
0,
0));
jScrollPane1.getViewport().add(jList1, null);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
final TestFrame testFrame = new TestFrame();
testFrame.setSize(200, 200);
testFrame.setVisible(true);
}
}
---------- END SOURCE ----------
(Review ID: 185722)
======================================================================