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. Clear explaination..Thank You Sir...
View Tutorial          By: nishanth at 2014-06-16 08:58:04

2. Hello,
i was run your given program in ecli

View Tutorial          By: vishnu chauhan at 2013-01-24 11:42:16

3. its very useful......to me
View Tutorial          By: dinesh at 2014-08-26 12:47:38

4. Hallo every one. I am working on my project in j2m
View Tutorial          By: radhe at 2010-12-14 08:08:25

5. good
View Tutorial          By: epuri at 2008-09-09 01:05:56

6. Plz can someone help me, I copied the code above a
View Tutorial          By: Dse90 at 2010-02-10 04:28:34

7. oh tnx a lot!i'v been lookin for a code like this!
View Tutorial          By: LES at 2012-01-13 12:55:09

8. Oh, Thanks for your code, but I think you should a
View Tutorial          By: Songokute at 2013-01-29 13:55:13

9. Thank u it helps me alot.....
View Tutorial          By: Ramya at 2012-02-22 10:16:14

10. hi issac thank you for your sample. can you please
View Tutorial          By: edwin at 2009-05-20 22:04:14