Originally Posted by
2by4
Right. Next time, you can perhaps try to see things from the perspective of someone JUST LOOKING AT THE OP and stop making IMPLICIT references to some earlier conversation I knew nothing about.
There was no implication- I told you to look at the OP's other posts as soon as you started this pointless arguing. You could have ended it right there.
But I've done my research on you, and from what you've said in other posts here and on other forums, I see that this is a bit of a pattern for you. You make statements that are categorically not true, and then you become overly defensive when other people call you out on it, shifting your argument just for the sake of arguing. I'm not really here to argue. I've tried to explain the reasons why the things you've said have either been false or simply bad advice, but you continually come back with non sequiturs and personal attacks. You might consider taking a moment to think about your approach- these are technical forums, and the only thing that really matters is the technical usefulness of your advice. I've shown you why your advice in this instance was not technically useful. Personal attacks don't really have a place here.
I've shown you why your advice was invalid, and you seem to be conceding that point, yet you continue to argue because of some vague notion that I didn't see things from your perspective. Perspective is irrelevant. Your advice was bad. I don't really care why, as long as you learn from the experience. Maybe you've learned that many questions here are indeed homework. Maybe you've learned that over complicating things isn't a good idea. Maybe you've learned to try out sample programs to test your assumptions. Or maybe you'll just keep arguing pointlessly.
Originally Posted by
2by4
Why not EXPLICITLY refer to the earlier thread??? And, no, it is not my responsibility to be rooting about for clues. OP should say it is an assignment for a basic java course. That obviously makes more sense that posters to the thread rooting about for possible clues!
I'm all for people with questions posting all relevant information. But 90% of the time, questions here are indeed homework assignments. It's not unreasonable to assume that any particular question is homework- in fact, that's a great practice to get into, as perhaps you've learned here. And when you started this incessant arguing, I told you to check out the OP's older posts so you would understand what we were talking about. However, even if this had not been a homework assignment, your advice was still pretty bad, and your claims were still simply wrong.
Originally Posted by
2by4
What it is, is that you don't know, or don't accept when you have misunderstood something. I stated categorically that it would work in a swing application. The swing timer ALREADY operates in its own thread as I categorically stated. There is no point arguing any further with you about it. Nothing is going in.
Here are some excerpts of what you said, keeping in mind that the OP's question was how to set the delay of a Swing Timer:
Originally Posted by
2by4
Load Microsoft Word on your machine :-)
Seriously, though, you need to read up on multithreading.
You need to have a controlling application and then launch your simulation on a separate thread, so that the controller and simulator are running in parallel.
Essentially you need an object of type Runnable passed to a Thread constructor, and then to call Thread.start();
The Timer MUST sit in a separate thread.
Obviously the animation and the timer shouldn't run in the same thread!!! You don't want them synchronous, lol!!!
The timer would normally be synchronous with the controller and should be asynchronous with the animation. So the controller would send an instruction to the animation, set the timer and wait for it to return before setting it for the next instruction. The animation, of course shouldn't wait (freeze) for the timer to return!!!
And tell me, while the animation is keeping the EDT busy, do you think the "Start Button", the "Speed Up" button, the "Slow Down" button, the "Stop Button" are going to be responsive?
He is trying to change the speed of the animation WHILE IT IS RUNNING. Not wait for it to finish and then press the "Speed Up" button!!!
If the action listener for the speed up button is in the same thread, it won't respond WHILE THE ANIMATION IS RUNNING.
You also threw in a bunch of non sequiturs about why threading is useful in certain cases, which was entirely beside the point. I told you to write a small program that tested your above statements, and when you refused, I did it for you. I posted a program that demonstrates the untruth of your arguments, and I explained to you several times now why your advice was wrong. Shifting the argument to "but you didn't see things from my perspective!" is irrelevant. I did know where you were coming from. And even if I hadn't, it wouldn't change the fact that you were wrong. I can't just let people post incorrect advice to an already confused OP.
There's really no point in being defensive. I have no interest in arguing; my only motivation is that we can't have bad advice being given out on the forums. I highly advise you to chalk this one up to a lesson learned and move on.