Name: boT120536 Date: 04/17/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
1. Exact steps to reproduce the problem
- Create a JDesktopPane.
- Create a JInternalFrame and add it to the JDesktopPane.
- Create a JPanel with a big minimumsize and BorderLayout.
- Add the JDesktopPane to the JPanel.
- Create a ScrollPane with that JPanel.
- Display that ScrollPane at a size smaller than the JPanel.
Now move the JInternalFrame over a border and back to the screen. If you move
it *slow*, you'll see pixel errors on the area that should be redrawn.
The visible reason for the bug: When a JInternalFrame is redrawn the
JScrollPane's borders, especially its scrollbars, are not subtracted from the
JDesktopPane's size.
2. Java SOURCE CODE that demonstrates the problem
import java.awt.*;
import javax.swing.*;
public class Bug3 {
public static void main(String[] args) {
JFrame f = new JFrame(); //"Bug");
JPanel panel = new JPanel() {
{ setLayout(new BorderLayout()); }
public Dimension getPreferredSize() {
return new Dimension(2000,2000);
}
public Dimension getMinimumSize() {
return getPreferredSize();
}
};
JDesktopPane desktop = (JDesktopPane) panel.add(new JDesktopPane
());
JInternalFrame iframe = (JInternalFrame) desktop.add(new
JInternalFrame("Test",true,true,true,true));
iframe.getContentPane().add(new JButton("Test"));
iframe.setSize(300,200);
iframe.setVisible(true);
f.getContentPane().add(new JScrollPane(panel));
f.setSize(java.awt.Toolkit.getDefaultToolkit().getScreenSize());
f.setVisible(true);
}
}
(Review ID: 120845)
======================================================================