Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

double buffering  RSS feed

 
Jude Fawly
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I wrote an applet program; my class extends JApplet. But what troubled me is that double buffering does not work when extending JApplet. I didn't know that extending JApplet is the reason. Two days later I changed my class to extend Applet class instead of JApplet. Here the same double buffering code (update and then paint; the known method) works fine without flickering.
I just want to know, if possible, the reason for that. I am not very good with the underlying reasons of programming issues.

Thanks.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way to draw in a JApplet is to add a graphic component to its content pane. The graphic component usually extends JPanel; other classes are okay, eg, JComponent. You override the JPanels paintComponent method and do your custom drawing inside. You will get double buffering this way. The paint method of a JApplet (a top-level container) is a Container method (AWT). You can check up on these details by looking up the painting method you use in the api of its parent class. The Method Detail section of the api has the details.
 
Jude Fawly
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try that.

Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!