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. What is the difference between an Interface and an
View Tutorial          By: RAJA at 2015-06-26 17:28:31

2. hi
very tnx for your code

View Tutorial          By: Moji at 2012-08-19 16:06:53

3. Hi, these are the lines i added after i downloaded
View Tutorial          By: sandeep,p at 2012-11-22 10:17:07

4. thanx mitra...it helped alot.
View Tutorial          By: psuyog at 2014-10-10 12:16:26

5. HI,
I want to send an sms via website to mo

View Tutorial          By: Hemant at 2008-11-04 05:26:30

6. please tell me.........
View Tutorial          By: case c++ at 2012-02-20 02:45:55

7. i see that lots of people get this exception : jav
View Tutorial          By: oded at 2008-09-28 03:33:33

8. I like ASP.net b'cs it is very easy to understand
View Tutorial          By: prachi at 2010-06-02 06:04:50

9. Thanks for the solution. I must say however that t
View Tutorial          By: Pierre at 2009-11-19 20:16:35

10. supb yar...very helpful
View Tutorial          By: narender lakshetty at 2010-07-23 23:20:00