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

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. Excellent!!!!!!!!!!!!
View Tutorial          By: Ramana at 2009-01-02 19:31:58

2. Thanx..very useful in this pgm..
View Tutorial          By: priya at 2013-02-06 10:54:44

3. My exchange email account is only partially delete
View Tutorial          By: ali at 2010-12-30 02:38:14

4. Does anybody know how to force using IPv6 by my la
View Tutorial          By: Marcin at 2011-05-17 05:24:51

5. it's cool
View Tutorial          By: RInam Shah at 2011-06-20 02:48:20

6. Please help me i am getting following error messag
View Tutorial          By: Balaji at 2009-09-23 22:54:06

7. Very informative and simple to understand. Thank y
View Tutorial          By: Rosa Vladivord at 2012-12-23 13:00:52

8. Good Job.
Keep up the good work .

View Tutorial          By: Syed Imran at 2010-11-27 06:54:36

9. Sir , I am doing BCS . I want to know more about
View Tutorial          By: Sachin deshmukh at 2010-08-04 02:24:59

10. tnx
View Tutorial          By: arion at 2011-06-03 01:24:30