Sleeping a thread

I want to prevent any action from happening in my applet until an item is selected in a menu, in this case "Reset".What would be the best way to achieve this?
[172 byte] By [adamwa] at [2007-10-3 3:34:25]
# 1
Set a flag with a name like isReset to false. In all of your action listeners, check this value for true or return. When the Reset menu option is chosen, set the flag to true. Make sure to set it back to false when appropriate.Brian
brian@cubik.caa at 2007-7-14 21:28:57 > top of Java-index,Java Essentials,New To Java...
# 2
I'm having to code with JDK 1.1 event handling so I cannot make use of action listeners. Sucks I know.
adamwa at 2007-7-14 21:28:57 > top of Java-index,Java Essentials,New To Java...
# 3

Really? How well do JDK 1.1 applets work with modern Java plugins? And why on Earth would you be forced to use such ancient technology? Or maybe you've been using Java for a long time?

My guess is that you need to push for a platform upgrade so that you can at least use a relatively modern event handling system. Don't ask me to remember back to the days of Java 1.1...

Brian

brian@cubik.caa at 2007-7-14 21:28:57 > top of Java-index,Java Essentials,New To Java...
# 4

This is part of an assignment I've been given, I have to code this applet using JDK 1.1, and again with post JDK 1.1 event handling.

I just need to disable the frame until "Reset" has been selected from the menu, there must surely be a method I can use?

Message was edited by:

adamw

adamwa at 2007-7-14 21:28:57 > top of Java-index,Java Essentials,New To Java...
# 5
I don't see what Java 1.1 versus 1.2 has to do with anything. Set a flag with a name like isReset to false. In all of your code that does something, check isReset before doing that something. When the "Reset" option is selected, change the flag to true.
DrClapa at 2007-7-14 21:28:57 > top of Java-index,Java Essentials,New To Java...
# 6
Sorry, I'm suffering from a cold and what you were saying didn't even sink in until now. Ofcourse, it's a simple solution, I'll give it a bash.
adamwa at 2007-7-14 21:28:57 > top of Java-index,Java Essentials,New To Java...
# 7
Thanks, works great now. I just enclosed the actions I wanted to disable with a boolean that had to be set to true through the "Reset" option.
adamwa at 2007-7-14 21:28:57 > top of Java-index,Java Essentials,New To Java...