![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
How to continue program operation while animation loop is runningI wrote a program, as an challenge. It basically pulls realtime youtube View Count stats off of the web and creates a graph.
The program works fine, but I decided to up the ante, so to speak, and create a little animated "refresh" graphic the runs while the data is being downloaded. It is a junky GLine version of the typical refresh graphic you see all the time (at least on macintoshes). It's a circle of lines that appear to rotate. The problem I have now is the animation is a while loop, so as soon as I tell the refresh graphic class to animate, the program is stuck in that loop and no more operations take place. The data is never pulled from the web. Game over. I've nearly completed the Stanford methodology course and I don't think this was ever covered - how do I create a looped animation in such a way that the program continues to operate? Thanks so much. The questions I asked on this forum when I first started the course seem so simple to me now -Ethan |
|||
|
#2
|
|||
|
|||
Re: How to operations while an animation loop is runningOkay, can't edit the title. nice...
|
|
#3
|
||||
|
||||
Re: How to operations while an animation loop is runningQuote:
Tell me what you want the new title to be and I will do it for you. Best regards, Lucian __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#4
|
||||
|
||||
Re: How to operations while an animation loop is runningQuote:
EDIT: Not seeing what's been done [no code?], it MAY be possible to change/update the graphic during the processing of the youtube retrieval, but depending on how the retrieval is handled might also slow the animation considerably. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#5
|
|||
|
|||
Re: How to operations while an animation loop is runningQuote:
"How to continue program operation while animation loop is running" would work better if it fits. Thanks! |
|
#6
|
|||
|
|||
Re: How to operations while an animation loop is runningQuote:
Thank you this is very enlightening. I'll post the code when I get home, if I can't get threading to work based on this documentation. |
|
#7
|
|||
|
|||
Re: How to continue program operations while animation loop is runningI read through the documentation on that Sun site as well as several other tutorials and took a stab at it... unsuccessfully.
Unfortunately, some of the concepts referred to in those tutorials are still beyond my comprehension. I understand the concept of threading and I understand the difference between implementing it in another subclass versus extending the Thread class directly. I think my purposes are better served implementing Runnable in this case. But, while the course has been very good for understanding general methodology in programming and understanding how to get Java to execute those concepts, it hasn't gotten into some of the information I would need to read this documentation and understand it. As a beginner programming course, the goal isn't to turn you into a Java expert as much as it is to expose you to general programming methodology. For instance, init and run methods are covered, but I'm still 2 classes away from covering the main method. Perhaps that will help shed more light. But also the concept of how to implement a class within another subclass in a general way (where I could look at this documentation and immediately understand how to do it) is not covered and probably won't be touched upon since I'm nearly done with the course. Here is the code for the "RefreshGraphic" class in question. JAVA Code:
So the class that calls this just needs the constructor plus the following: Code:
The graphic is far from pretty, but I haven't learned any more advanced graphics concepts. But, it's close enough that the user knows what it represents. That aside, the obvious problem in my program is the animate method contains an infinite loop. I could step through the animation while another method retrieves the youtube data line by line, but that would almost certainly make the animation graphic look even junkier! It would be better to have the two processes happening concurrently and be able to interrupt the animation process when all the data is finished downloading. Last edited by LuciWiz : 24-Sep-2009 at 13:51.
Reason: Please insert your Java code between [java] & [/java] tags
|
|
#8
|
|||
|
|||
Re: How to continue program operations while animation loop is runningSorry about that LuciWiz, used the code tag by accident. Thanks for the fix.
-e |
|
#9
|
||||
|
||||
Re: How to continue program operation while animation loop is runningI'm having trouble with the acm package.
I've downloaded the acm.jar, but compiling still gives many errors. So, do I need more acm stuff, or is there more that I might need to know? __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! Last edited by TurboPT : 25-Sep-2009 at 20:28.
|
|
#10
|
|||
|
|||
Re: How to continue program operation while animation loop is runningThat's the entire code for the class including imports. I just checked and it runs fine here. I'm using Eclipse on a Mac and the acm stuff came with the software when I installed it.
I wrote a quick little tester program just to make sure. Displays fine (in all its intricate graphic beauty) JAVA Code:
|
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Equation solver | RazoR | C Programming Language | 3 | 18-May-2008 10:24 |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 08:44 |
| Two-Tier data dissemination code installation problem | nidhibansal1984 | Computer Software Forum - Linux | 6 | 16-Sep-2007 11:13 |
| Text-Based Roulette Game | mfm1983 | C++ Forum | 5 | 29-Nov-2006 13:20 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The