Reputation: 1
I am using netbeans 6.8 .If a sound file is playing, a button on the jframe wont work while the sound file is playing. The user should still be able to press the button while it is playing.
I tried to find it but the codes are very complex.
Use Main implements runnable{}
Multithread this problem.
Upvotes: 0
Views: 152
Reputation: 115388
You can either implement thread yourself or use higher level tools like
Here is how you can run task asynchronously using your own thread:
new Thread() {
public void run() {
// write here your code
}
}.start();
Upvotes: 1
Reputation: 22656
It sounds like you are playing a sound on the Event despatch thread. Any long running tasks should not be run on this since, as you've seen, it'll lock the gui.
Upvotes: 5
Reputation: 7505
Try SwingWorker. There are Tutorial and StackOverflow question.
Upvotes: 2