-
Bug
-
Resolution: Fixed
-
P4
-
1.1.3
-
b01
-
sparc
-
solaris_2.5.1
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2015904 | 1.1.3 | Jeff Dinkins | P4 | Closed | Cannot Reproduce |
JPanel that has no double buffering draws its components without cleaning previous screen. As a result of that, components from different JPanel can be seen at the same time.
To reproduce the problem, run the following test app.
The first tab has double-buffering panel while the second has non double buffering panel.
Test Procedure:
click first tab and second tab.
// Test app
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class Test extends JFrame{
JScrollPane sp1, sp2;
JPanel onePanel;
JPanel otherPanel;
JTabbedPane tp;
// if the container panel has double-buffering, it works fine no matter what
// children panels has double or non double buffering to draw their
// components.
public static JPanel bodyP = new JPanel(); // true
public Test() {
super("test");
bodyP.setLayout(new BorderLayout());
onePanel = new JPanel(true);
onePanel.setLayout(new BoxLayout(onePanel, BoxLayout.X_AXIS));
onePanel.add(new JButton("one"));
otherPanel = new JPanel(false);
otherPanel.add(new JButton("two"));
tp = new JTabbedPane();
tp.addTab("test-tab1", null, onePanel);
tp.addTab("test-tab2", null, otherPanel);
tp.setSelectedIndex(0);
bodyP.add("Center",tp);
}
public static void main(String args[]) {
WindowListener wl = new WindowAdapter(){
public void windowClosing(WindowEvent event){
System.exit(0);
}
};
Test frame = new Test();
frame.setBackground(Color.lightGray);
frame.addWindowListener(wl);
frame.setSize(500,200);
frame.add("Center", bodyP);
frame.show();
}
}
// end of file.
To reproduce the problem, run the following test app.
The first tab has double-buffering panel while the second has non double buffering panel.
Test Procedure:
click first tab and second tab.
// Test app
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class Test extends JFrame{
JScrollPane sp1, sp2;
JPanel onePanel;
JPanel otherPanel;
JTabbedPane tp;
// if the container panel has double-buffering, it works fine no matter what
// children panels has double or non double buffering to draw their
// components.
public static JPanel bodyP = new JPanel(); // true
public Test() {
super("test");
bodyP.setLayout(new BorderLayout());
onePanel = new JPanel(true);
onePanel.setLayout(new BoxLayout(onePanel, BoxLayout.X_AXIS));
onePanel.add(new JButton("one"));
otherPanel = new JPanel(false);
otherPanel.add(new JButton("two"));
tp = new JTabbedPane();
tp.addTab("test-tab1", null, onePanel);
tp.addTab("test-tab2", null, otherPanel);
tp.setSelectedIndex(0);
bodyP.add("Center",tp);
}
public static void main(String args[]) {
WindowListener wl = new WindowAdapter(){
public void windowClosing(WindowEvent event){
System.exit(0);
}
};
Test frame = new Test();
frame.setBackground(Color.lightGray);
frame.addWindowListener(wl);
frame.setSize(500,200);
frame.add("Center", bodyP);
frame.show();
}
}
// end of file.
- backported by
-
JDK-2015904 JPanel with no double buffer draws its components without erasing behind screen.
- Closed