Im not sure I understand your question, but anyway...
First of all, it looks like you're sleeping the main thread, which will cause your application to freeze for a number of seconds.
I might be off here but do you want to fire a new thread for each button but avoid write reduntant code? If so, then create a class that extends Thread and fire it with method start()
public class MyThread extends Thread {
public MyThread(/*argument here if needed*/) {
}
public void run() {
try {
Thread.sleep(sleepTime);
}catch(InterruptedException ie) {
}
// Do something here
}
}
fire the thread like:
Reputation Points: 22
Solved Threads: 13
Junior Poster in Training
Offline 66 posts
since Sep 2008