JDK-6727241 : Provide public APIs to set background erase properties
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P5
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-07-18
  • Updated: 2011-04-04
  • Resolved: 2011-04-04
Related Reports
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
Related to bug #6691181. AWT should provide public APIs for setting the following system properties:

sun.awt.noerasebackground
sun.awt.erasebackgroundonresize

JUSTIFICATION :
It is currently impossible to disable the "flicker" effect when an applet is resized (even in J6u10).

---------- BEGIN SOURCE ----------
import java.applet.Applet;

import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;

public class AppletTest extends Applet {
    public static final long serialVersionUID = 0;
    
    public static class TestCanvas extends Canvas {
        public static final long serialVersionUID = 0;

        @Override
        public void paint(Graphics graphics) {
            graphics.setColor(Color.RED);
            graphics.fillRect(0, 0, getWidth(), getHeight());
        }

        @Override
        public void update(Graphics graphics) {
            paint(graphics);
        }
    }

    @Override
    public void init() {
        setLayout(new BorderLayout());
        add(new TestCanvas(), BorderLayout.CENTER);
    }

    @Override
    public void update(Graphics graphics) {
        paint(graphics);
    }
}


---------- END SOURCE ----------