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. it provides manna in the studies of java to me
View Tutorial          By: aravinden at 2011-12-27 08:18:18

2. Dude, you made my day.
View Tutorial          By: Sebasti├ín at 2011-08-29 14:01:10

3. hi....
i want to send sms to any mobile by

View Tutorial          By: prerna at 2010-07-09 20:15:48

4. This tutorial is really Good and enhance my desire
View Tutorial          By: Yasin at 2011-07-09 10:04:57

5. How can you print this using recursion?

View Tutorial          By: Menon at 2011-09-08 07:16:02

6. very useful article. every jsp resource will get g
View Tutorial          By: pechirani at 2011-06-29 04:00:49

7. can someone explain above example in detail
View Tutorial          By: neha at 2012-03-24 05:57:34

8. cool!!!

can you show me some sample

View Tutorial          By: eduard jacob bernido at 2008-07-14 04:01:59

9. if(isset($_POST["check1"]=="1"
View Tutorial          By: krunal at 2012-11-22 10:30:19

10. thanks!!
View Tutorial          By: eoko at 2011-05-10 23:34:29