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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "watching an applet to draw waveform" Watch "watching an applet to draw waveform" New topic

watching an applet to draw waveform

anteneh mamo

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

Joined: Jul 08, 2003
Posts: 24199

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]
I agree. Here's the link:
subject: watching an applet to draw waveform
It's not a secret anymore!