• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JApplet flickering

 
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there, I have a JApplet...
FotoCube
When twisting the cube
(Drag on a center of large face, or outside cube to rotate)
(Drag elsewhere on cube to twist it)
There is a little bit of flickering (this is especially noticeably on the Mac G4 ibook).
But I have converted it to double-buffering, so I don't see how it can do this.
Is there any way to solve this, perhaps I am double-buffering wrong, esentially I have...


Can anyone help?
Thanks very much
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As the first line of the constructor, try this.

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I tried it, but has no effect.
Not sure what that does, I'll look at the API.
 
Keith Lynn
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I couldn't get your URL to load to see what you're talking about.

Using the constructor of a JPanel that accepts a boolean, you can cause the JPanel to be drawn using double buffering.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, don't see why it doesn't load.
Here is the address...
http://www.colin-java.co.uk/FotoCube/index.htm
Perhaps is you just goto the site www.colin-java.co.uk,
then you can click on FotoCube.

But you might not notice any flickering when you twist the cube.
I only seem to get it when using a Mac, and my friend get its on his pc too. But on my pc I don't. Perhaps its strong CPU, and RAM (3Ghz, 1G ram) that makes some difference.
Occasionally I will see a black flicker between faces on a slice of the cube that is undergoing a twist.
When rotating, I don't think there is any flicker, its just the twisting, which is run as runnable inside a loop, with a Thread.sleep(...) call to slow down the movement.

Perhaps if I speed it up or slow it down, the flicker will go, I'm just not sure, I haven't experienced this before.

Any help is great, thanks.
[ April 04, 2007: Message edited by: colin shuker ]
 
Keith Lynn
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried it, and I didn't get any flicker.

By the way, it's a very nice product.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that means a lot, especially coming from a java expert.
But, I still get flickering when used on mac, or on friends pc.
Have you got any ideas of how I might fix it?

Thanks
 
Keith Lynn
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have a Mac to experiment with, so I really don't have a suggestion about how to test it.

One thing you might try is removing the manual double buffering you have and just use the super(true) in the constructor.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've tried that, and no change.
I've just set up eclipse on the mac, and so I can fiddly about with
the code on it, instead of emailing it over.
I'm gonna try changing speed of twist, perhaps the way I have the animation set up is bad, I don't know.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there, I've 99% fixed the flicker,
When you invoke a twist, you get...



Initially I had invokeLater for the repaint() which was causing the bad flickering on the mac, and a different pc, but now there is just 1 flicker the instance it starts to turn, then it is smooth.

Hopefully I can iron out that flicker.
Any comments with threads or anything is appreciated since I'm crap at them.

Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic