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



Ask a Question

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. I am new in Java and got good information to under
View Tutorial          By: Umesh Kumar at 2012-01-25 08:42:07

2. A more complete description of the common pitfalls
View Tutorial          By: Phil at 2012-11-25 02:06:49

3. Hello all..
can anyone please help me.. i

View Tutorial          By: Christoven at 2011-06-15 05:55:16

4. good job
View Tutorial          By: gopi at 2008-07-01 02:02:48

5. Thanks. What datatype can we give to a variable St
View Tutorial          By: Bafokeng Lebesa at 2012-11-27 12:35:40

6. Nice example. Thank you very much.
View Tutorial          By: vinod at 2012-06-19 11:19:53

7. Thanks dear
View Tutorial          By: Muthin at 2009-04-29 00:32:24

8. its easy to understand your example in overloading
View Tutorial          By: rovie at 2011-09-07 02:41:12

9. i like the example and it helped me understand the
View Tutorial          By: Danny at 2009-10-23 02:09:06

10. Nice Intro to start J2Me
View Tutorial          By: Mak at 2009-07-04 10:36:00