Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

Double Buffering in Java 6

Thread view: 
Jason Cavett - 30 Nov 2007 17:02 GMT
I just wanted to clarify.  I noticed that improvements were made to
double buffering in Java 6 (true double buffering is now used) as
discussed here: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/.
However, I heard someone mention that double buffering is now on by
default on all components in Java 6.  Is this second statement true?
Knute Johnson - 30 Nov 2007 17:58 GMT
> I just wanted to clarify.  I noticed that improvements were made to
> double buffering in Java 6 (true double buffering is now used) as
> discussed here: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/.
> However, I heard someone mention that double buffering is now on by
> default on all components in Java 6.  Is this second statement true?

No.  Although it appears that you can turn it on.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class test {
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                JLayeredPane lp = new JLayeredPane();
                System.out.println("JLayeredPane " +
lp.isDoubleBuffered());
                JRootPane rp = new JRootPane();
                System.out.println("JRootPane " + rp.isDoubleBuffered());
                JPanel p = new JPanel();
                System.out.println("JPanel " + p.isDoubleBuffered());
                JButton b = new JButton();
                System.out.println("JButton " + b.isDoubleBuffered());
                JComboBox cb = new JComboBox();
                System.out.println("JComboBox " + cb.isDoubleBuffered());
                JLabel l = new JLabel();
                System.out.println("JLabel " + l.isDoubleBuffered());
                JInternalFrame f = new JInternalFrame();
                System.out.println("JInternalFrame " +
f.isDoubleBuffered());
                JScrollPane sp = new JScrollPane();
                System.out.println("JScrollPane " + sp.isDoubleBuffered());
                Box bx = new Box(0);
                System.out.println("Box " + bx.isDoubleBuffered());
                JTextArea ta = new JTextArea();
                System.out.println("JTextArea " + ta.isDoubleBuffered());

                Canvas c = new Canvas();
                System.out.println("Canvas " + c.isDoubleBuffered());

                b.setDoubleBuffered(true);
                System.out.println("\nJButton " + b.isDoubleBuffered());
                cb.setDoubleBuffered(true);
                System.out.println("JComboBox " + cb.isDoubleBuffered());
                sp.setDoubleBuffered(true);
                System.out.println("JScrollPane " + sp.isDoubleBuffered());
                ta.setDoubleBuffered(true);
                System.out.println("JTextArea " + ta.isDoubleBuffered());
            }
        });
    }
}

C:\Documents and Settings\Knute Johnson>java test
JLayeredPane false
JRootPane true
JPanel true
JButton false
JComboBox false
JLabel false
JInternalFrame false
JScrollPane false
Box false
JTextArea false
Canvas false

JButton true
JComboBox true
JScrollPane true
JTextArea true

Signature

Knute Johnson
email s/nospam/knute/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.