Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

animation in java

 
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
 
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


 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • 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 Spring Java
  • 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
 
Something about .... going for a swim. With this tiny ad ...
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic