Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

animation in java

 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm developing a cell phone simulation ( to learn java graphics ) using java applet. This applet should allow clicking on buttons just like real phone. I know this sort of application involves lot of work but I just want to learn the basic idea to develop such animation.
I really appreciate some guidance.
Thanks
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think you should be doing this with the help of j2me platform ..... check out www.sun.java.com for more info on j2me.
Originally posted by Dilipkumar Kalyankar:
Hi,
I'm developing a cell phone simulation ( to learn java graphics ) using java applet. This applet should allow clicking on buttons just like real phone. I know this sort of application involves lot of work but I just want to learn the basic idea to develop such animation.
I really appreciate some guidance.
Thanks

 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most animation in java deals with sequences of Images and threads to control the frame rate... with what you describe I don't think you would need a thread, though... just have an image of each button in the up position and in the down position and have a MouseListener to change the images. Since the redraw will only be a small area ( the graphic of the button ) you may want to look into the topic of clipping...

HTH,
-Nate
 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys...
I need to implement something like this: http://nytest.liveproducts.com/A2218z/
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're going to need to look into threads to control the animation of the main panel... do the buttons just like I mentioned above... and to make the animation smoother, look into double-buffering. It improves the quality of the animation by drawing to an offscreen image and then drawing the offscreen image to the applet in one step, so you don't have redraw problems... here's a quick example of how to do double buffering...

-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic