Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How To Stop Flicking JPanel Component?  RSS feed

 
Tom Finn
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code below flickers when I update. I've heard about double buffering but no idea how it works/how I would implement that.

 
Campbell Ritchie
Sheriff
Posts: 53750
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through the JPanel constructors; there is one with a boolean parameter. All you have to do is pass true to that.
I am not certain that is the correct solution, but double-buffering is the first thing I would try.
 
Campbell Ritchie
Sheriff
Posts: 53750
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would seem to suggest that missing out the boolean flag will give it a double buffer, if you look at the JPanel ←link documentation. But it is still worth a rty.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is this doing in paintComponent?
x = new Converter();
 
Tom Finn
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good idea. I tried it but it didn't work though.
 
Tom Finn
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is this doing in paintComponent?
x = new Converter();

I just spotted that myself. (The program is quite large).

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