Java developers often need to use graphics and drawing APIs. Due to limited capability of Java SDK, Microsoft's DirectX API (DirectDraw or ddraw) on Window machine results into drawing problems when using external graphics accelerator card and thus Swing component drawing starts flickering.
The work around to this problem is to set ddraw flag off. There are separate methods to disable this flag in Java Application and in Java Applet.
1) For Java Application:
Either add below line in main function as the first line:
System.getProperties().Put("sun.java2d.noddraw", "true");
Use the below option in command prompt to run a Jar file:
java -Dsun.noddraw=true -jar examle.jar
In Applet to make ddraw flag off user has to set the Java Runtime Parameters in Java plug-in control panel by.