• Post Reply Bookmark Topic Watch Topic
  • New Topic

watching an applet to draw waveform

 
anteneh mamo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've got a perfectly working applet , the problem is that my applet draws waveform reading the values from int []array, and the moment i press the draw button of the applet,it draws it instantly. ofcourse i can see the waveform by scrolling back to see the drawn waveform. but i want to be able to see the waveform while it is being drawn. i can understand why the compiler does this. could you suggest me a sort of delay mechanism or another. please i need it as quickly as possible.

thank you in advance!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically you want to do animation. Instead of a paint method that draws the whole waveform, write a paint method that draws some part of the waveform, controlled by a numeric parameter. Create a thread which sleeps, updates the parameter, and calls repaint(). By controlling the sleep time, you control the rate at which the waveform will appear.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!