This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Applets and the fly likes watching an applet to draw waveform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "watching an applet to draw waveform" Watch "watching an applet to draw waveform" New topic
Author

watching an applet to draw waveform

anteneh mamo
Greenhorn

Joined: Jul 05, 2007
Posts: 4
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
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
 
jQuery in Action, 2nd edition
 
subject: watching an applet to draw waveform
 
Similar Threads
Drawing on an applet
DoubleBuffering when there are buttons
Draw a Shape by selecting(combox) its color and clicking a button
Class to draw a circle to Jframe
Getting pixels from a Graphics instance