Avatar billede fredand Forsker
14. maj 2004 - 12:38 Der er 1 kommentar og
1 løsning

Double buffering with Swing?

Hello!

I'm taking a course in Internetprogramming. Now we have a task to create a applet that works like the demo-applet "NervousText". But our task is to use Swing components with double buffering. Correct me if I'm wrong when I say that Swing uses double buffering as default, but I have tried to turn it off but I do not see any performance loss at all. If I do the same with AWT components I can see a great difference in performance.

At this site I got 4 applets that tries do demonstrate this.
http://medlem.spray.se/fredand44/mint/1e/1e.html
1 Swing-applet with setDoubleBuffered(false)
1 Swing-applet with setDoubleBuffered(true) or default
1 AWT-applet without double buffering
1 AWT-applet with double buffering

So if any one could tell me if there is a better way to create Swing componets with double buffering and how to turn it off please tell me.

Perhaps some one could explaine to me why I do not see any difference in performance between setDoubleBuffered(false/true) when I use Swing components? Is there an other way to create Swing componets with double buffering?

Best regards
Fredrik
BTW please give "svar" so I can reward all of you!
Avatar billede Slettet bruger
16. maj 2004 - 12:51 #1
I don't know if it makes any difference at all, but it might have significant impact to call the setDoubleBufferent(<bool value>) before you call the show() / visible(true) method ?

I don't notice much difference between the two versions of the swing-applets either. But if I look at the version 1 applet intensely for 3 minutes, it does appear to flicker a bit to me.

Don't know if this is worth any points, anyways - here's a answer.

Regards Anders
Avatar billede fredand Forsker
17. maj 2004 - 09:09 #2
Thanks for your comment mate!
Best regards!
Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester