-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta2
-
sparc
-
solaris_8
In Sun Management Center, Graphics.paintImage() is being used, we first copy the screen to a image as double buffer, then when there is a request from awt for repaint, the image will be painted again.
Under jdk1.2, the speed to paint the image is quick, but under jdk1.4, the paint speed is very slow.
refer to /net/hotsauce.eng/guest/sunmc_jdk1.4/src/java/com/sun/symon/base/console/views/topology/CvTopologyViewPanel.java for the implementation of SunMC.
Please compile and run the following codes under jdk1.2 and jdk1.4, you can find the refresh difference.
import javax.swing.*;
import java.awt.*;
import javax.swing.plaf.*;
public class Test {
Image DoubleBuffer = null;
public Test() {
JFrame f = new JFrame();
MyCom com = new MyCom();
f.getContentPane().add(com);
f.setSize(800, 500);
f.setVisible(true);
com.createDBBuffer();
}
public static void main(String[] args) {
new Test();
new Test();
}
}
class MyCom extends JComponent {
Image DoubleBuffer = null;
public MyCom() {
setUI(MyComUI.createUI(this));
}
public void createDBBuffer() {
DoubleBuffer = createImage(500, 500);
Graphics gr = DoubleBuffer.getGraphics();
gr.setFont(getFont());
gr.setColor(Color.blue);
gr.fillRect(0, 0, 800, 500);
}
public void paintBuffer(Graphics gr) {
if (DoubleBuffer != null) {
gr.drawImage(DoubleBuffer, 0, 0, Color.black, null);
}
}
}
class MyComUI extends ComponentUI {
MyCom com;
public MyComUI(JComponent c) {
com = (MyCom)c;
}
public void paint(Graphics g, JComponent c) {
com.paintBuffer(g);
}
public Dimension getPreferredSize(JComponent c) {
return new Dimension(800, 500);
}
public Dimension getMinimumSize(JComponent c) {
return getPreferredSize(c);
}
public Dimension getMaximumSize(JComponent c) {
return getPreferredSize(c);
}
public static ComponentUI createUI(JComponent c) {
return new MyComUI(c);
}
}
Under jdk1.2, the speed to paint the image is quick, but under jdk1.4, the paint speed is very slow.
refer to /net/hotsauce.eng/guest/sunmc_jdk1.4/src/java/com/sun/symon/base/console/views/topology/CvTopologyViewPanel.java for the implementation of SunMC.
Please compile and run the following codes under jdk1.2 and jdk1.4, you can find the refresh difference.
import javax.swing.*;
import java.awt.*;
import javax.swing.plaf.*;
public class Test {
Image DoubleBuffer = null;
public Test() {
JFrame f = new JFrame();
MyCom com = new MyCom();
f.getContentPane().add(com);
f.setSize(800, 500);
f.setVisible(true);
com.createDBBuffer();
}
public static void main(String[] args) {
new Test();
new Test();
}
}
class MyCom extends JComponent {
Image DoubleBuffer = null;
public MyCom() {
setUI(MyComUI.createUI(this));
}
public void createDBBuffer() {
DoubleBuffer = createImage(500, 500);
Graphics gr = DoubleBuffer.getGraphics();
gr.setFont(getFont());
gr.setColor(Color.blue);
gr.fillRect(0, 0, 800, 500);
}
public void paintBuffer(Graphics gr) {
if (DoubleBuffer != null) {
gr.drawImage(DoubleBuffer, 0, 0, Color.black, null);
}
}
}
class MyComUI extends ComponentUI {
MyCom com;
public MyComUI(JComponent c) {
com = (MyCom)c;
}
public void paint(Graphics g, JComponent c) {
com.paintBuffer(g);
}
public Dimension getPreferredSize(JComponent c) {
return new Dimension(800, 500);
}
public Dimension getMinimumSize(JComponent c) {
return getPreferredSize(c);
}
public Dimension getMaximumSize(JComponent c) {
return getPreferredSize(c);
}
public static ComponentUI createUI(JComponent c) {
return new MyComUI(c);
}
}
- relates to
-
JDK-4468409 b67: dga library doesn't get loaded due to dlopen error
-
- Resolved
-
-
JDK-4468561 Solaris sparc: serious slowdown in array creation since build 46
-
- Closed
-