aspose file tools*
The moose likes Applets and the fly likes JApplet flickering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "JApplet flickering" Watch "JApplet flickering" New topic
Author

JApplet flickering

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
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
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
As the first line of the constructor, try this.

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Thanks, I tried it, but has no effect.
Not sure what that does, I'll look at the API.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
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

Joined: Apr 11, 2005
Posts: 744
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

Joined: Feb 07, 2005
Posts: 2367
I tried it, and I didn't get any flicker.

By the way, it's a very nice product.
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
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

Joined: Feb 07, 2005
Posts: 2367
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

Joined: Apr 11, 2005
Posts: 744
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

Joined: Apr 11, 2005
Posts: 744
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JApplet flickering