Comment on Tutorial - wait(), notify() and notifyAll() in Java - A tutorial By Jagan



Comment Added by : Nick

Comment Added at : 2011-12-06 05:10:19

Comment on Tutorial : wait(), notify() and notifyAll() in Java - A tutorial By Jagan
I have a question. So here I have a progress bar, but it seems to not move. I needed a way to wait sixty seconds before it added a number to the value, so I went to this. I have no idea how to use this, and thought I was using it correctly. The compiler seems to disagree. Here's my progress bar code:

//makes the progress bar
JProgressBar Bar = new JProgressBar(0, 15);
int a = 0;
while (a <15) {
a = a + 1;
Bar.wait(60000);
notify();
}
Bar.setValue(a);
Bar.setStringPainted(true);
Bar.setBounds(700, 75, 206, 40);
Bar.setBorder(BorderFactory.createRaisedBevelBorder());
contentPane.add( Bar );

what i'm focusing on is the while loop. inside that, the compiler is complaining about the wait line. Apparently I am using this wrong. How do I use it right?


View Tutorial



Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Hi
I tried to use this class , I don't get

View Tutorial          By: Asela at 2012-01-26 19:05:14

2. Different from the others,Good One
View Tutorial          By: Amiiiii java slayer at 2009-10-14 08:10:26

3. What if I wanted POST instead of GET?
View Tutorial          By: Otto at 2011-06-12 15:38:50

4. would like to have copy of clock
View Tutorial          By: jim johnson at 2008-04-10 17:30:06

5. good and nice
View Tutorial          By: Elayaraja j at 2011-06-18 05:30:07

6. thankssss to prograem
View Tutorial          By: maha at 2010-05-21 05:14:36

7. new Thread(this , "Demo thread") mean
View Tutorial          By: shalini at 2011-12-06 07:29:20

8. hi..i did a sms sending pgm..it works without erro
View Tutorial          By: Ragesh Gopal at 2011-09-02 10:02:59

9. Excellent information in simple language. Its wort
View Tutorial          By: Rishi at 2011-11-04 05:03:24

10. static concept was clearly explained with some exa
View Tutorial          By: Rajkumar s ,m.p.patti,rasipuram. at 2012-03-28 16:17:31