This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes can we display images in sequence which will gives perception of motion in frame's contentPane ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "can we display images in sequence which will gives perception of motion in frame Watch "can we display images in sequence which will gives perception of motion in frame New topic
Author

can we display images in sequence which will gives perception of motion in frame's contentPane ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

can we display images in frame which can give perception of motion very similar to videos ....i short can we display sequence of images so that it is played like a video ?
i have tried but ..the images where over lapping other and GUI gets hanged does any one has done that before ?


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
Of course you can do that. There are many ways to do that. One way is to use a javax.swing.Timer to update the image.
Don’t update the image more than 50 times a second; you can’t see 50 changes a second, and you need at least 10ms for the repainting.
Don’t update the image less than 25 times a second, or it will appear jerky.
Make sure to use the super. call as the first line in the paintComponent method.
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

Campbell Ritchie wrote:Of course you can do that. There are many ways to do that. One way is to use a javax.swing.Timer to update the image.
Don’t update the image more than 50 times a second; you can’t see 50 changes a second, and you need at least 10ms for the repainting.
Don’t update the image less than 25 times a second, or it will appear jerky.
Make sure to use the super. call as the first line in the paintComponent method.

thanks i have implemented the solutions also but , now the problem is CPU consumption which is 100% for 22.22 fps and 98-96% for 10 fps ....my pc is single core 2.8 GHZ with 2GB of Ram
and my solution or software is for non tech people whose configuration is quite similar to mine..
Note: Currently mine solution is single threaded ...what efforts i can make so that it takes near about 40-50 % of cpu or even less ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
Don’t know about your performance and CPU load problem, but graphics can be very heavy on system resources. What do you get from system monitor (*nix) or task manager (Windows®); those tools will show you which process uses how much chip? Have you tried any profiling tools as discussed in this thread?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can we display images in sequence which will gives perception of motion in frame's contentPane ?
 
Similar Threads
Need help to solve this co-ordinate & pixel problem ?
transparent applet and motion image
Tooltip on Line2D or Rectangle2D
'Shuffling' GUI fx using Mouse Motion Event listener code
Atheism or Theism??