What is the use of double buffering in swings?

Answer

Double buffering can be achieved by using the Jcomponent class that allows the Swing component to enable this feature. Double buffering allows the component to execute faster or take less time to render the individual parts of the screen. It allows the component to be drawn and doesn't refresh it all the times. The refreshes done, in the background for the processes that requires the dynamic content to be displayed. Due to this, the flickering of the component gets reduced and the component appears to be smooth. The screen updates the monitor at very high speed so that the component appears to perform well. Copies of the component within the area are faster and the rendering can be performed at higher speed by knowing the position of the component. The program that can be used to activate the buffering is:

boolean doubleBuffered property of JComponent. Passing in true to the
setDoubleBuffered()
// This is the method that enables the double buffering for the component. It holds two values true or false
JButton button = new JButton("test");
button.setDoubleBuffered(true);
// The value true is used to turn on double buffering

All swing Questions

Ask your interview questions on swing

Write Your comment or Questions if you want the answers on swing from swing Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---