![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#11
|
|||
|
|||
Re: How to continue program operation while animation loop is runningHere's specifically what you need to import in the RefreshGraphic class to get it to work
JAVA Code:
|
|||
|
#12
|
||||
|
||||
Re: How to continue program operation while animation loop is runningOk, I'll give a shot again (won't be at this very minute, though) and see how it goes.
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#13
|
|||
|
|||
Re: How to continue program operation while animation loop is runningYes, please take your time. Far from critical!
Thanks so much, Ethan |
|
#14
|
|||
|
|||
Re: How to continue program operation while animation loop is runningI rewrote the TestRefreshGraphic code so that it requires some threading in order to operate. Basically, if you can show me how to rewrite this and/or the RefreshGraphic class, I think I'll understand how to implement threading.
JAVA Code:
Your tips are very much appreciated! -Ethan |
|
#15
|
||||
|
||||
Re: How to continue program operation while animation loop is runningOk, after getting by an ISP issue, and working with another PC (the other I tried to use initially only has gcj, and it might not have everything necessary), but I was able to get your classes to compile (finally) and I saw the counter-clockwise 'spinner', so at least this is a step forward!
So, I can tinker with this more now, and I've also come to the realization that it's been about 5, if not 6, years since I've tinkered with Java threads, so I might be back to a small learning curve myself __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#16
|
|||
|
|||
Re: How to continue program operation while animation loop is runningTo my surprise (they were supposed to cover the "Main" method) the professor covered threading in the class I just watched. I was able to rewrite the RefreshGraphic class and the TestRefreshGraphic class so that it worked just fine.
I'll post in a few moments when I get in. Sone methods are deprecated from what I could see in the javadocs. I believe start() & interrupt() are what are used to begin & end a thread, but I'd be the wrong guy to confirm this |
|
#17
|
|||
|
|||
Re: How to continue program operation while animation loop is runningSo in the interest of closure, I'll post the code that implements threading and appears to function properly.
First off, I went into the RefreshGraphic class as posted on page 1 of this topic, and changed the "public void animate()" method to "public void run()" Otherwise that code stayed the same and it still implements Runnable. Then I re-wrote the TestRefreshGraphic class: JAVA Code:
TurboPT, I know you jumped through some hoops to help me out. Thanks so much for taking the time out and pointing me in the right direction! Of course, if you see any improvements to the code, I'd welcome them in the interest of edumacatin myself. Cheers! -Ethan |
|
#18
|
||||
|
||||
Re: How to continue program operation while animation loop is runningI got something working too, and here's what I came up with:
RefreshGraphic class: [I reworked parts of addTo(), added two functions, renamed animate() to run()] JAVA Code:
[I added extra labels and pause()'s for brief viewing in the GUI output] JAVA Code:
EDIT: So, somewhere between startAnimation() and killAnimation() is where the youtube retrieval stuff would go. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#19
|
|||
|
|||
Re: How to continue program operation while animation loop is runningOh, that's interesting. You put the threading into the RefreshGraphic class itself. Is that better style than putting it into the class that calls it?
In a more complicated program is it better to have classes manage their own threads like that, or is it better to have them all in the main class? Thanks again, Ethan |
|
#20
|
|||
|
|||
Re: How to continue program operation while animation loop is runningQuote:
Yup, I've already extrapolated to my other program! It works! |
Recent GIDBlog
Problems with the Navy (Chiefs) 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