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



Subscribe to Tutorials

Related Tutorials

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

Java program to check if user input is an even number

Archived Comments

1. the article is very useful...!
View Tutorial          By: pravin salame at 2011-05-20 11:58:28

2. This code worked but it only add the same vales se
View Tutorial          By: Dammy Temmy at 2013-01-17 17:22:17

3. In the above program, the instance variables like
View Tutorial          By: Abhikumar.M at 2012-08-02 17:25:55

4. sir i want to knw abt all simple java programs pls
View Tutorial          By: sakthi at 2011-08-29 14:06:10

5. To execute program you need comm.jar that is not a
View Tutorial          By: shreyansh shah at 2012-07-11 05:57:42

6. Hi Jim, to get the code for this clock, right clic
View Tutorial          By: Rajan at 2008-04-11 08:25:03

7. Works great! Thanks!
View Tutorial          By: Ewa at 2013-06-19 10:52:07

8. if the number is for exemple 00025478 it return a
View Tutorial          By: ahmed at 2015-02-11 12:02:45

9. Hello, I have a problem
I cant understand s

View Tutorial          By: henry at 2012-01-10 07:53:05

10. What is this....for simple question every one was
View Tutorial          By: Kaify at 2011-07-27 21:35:52