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. hope this may help u

class product<

View Tutorial          By: princess at 2011-11-30 12:11:57

2. 3221225477 is C0000005 in hex notation, which is j
View Tutorial          By: Stan at 2009-06-29 12:14:25

3. Is there a code that can hide smses, when they ent
View Tutorial          By: James at 2010-11-18 03:32:56

4. i understand but i want many information and prog
View Tutorial          By: malathi at 2013-03-29 23:52:28

5. It'z to hard to study a computer programming.but i
View Tutorial          By: christine idio at 2009-10-20 02:06:58

6. very nice
View Tutorial          By: prasad at 2009-11-11 05:03:16

7. my quseation is why use we return statement

View Tutorial          By: pankaj kumar at 2010-08-31 03:53:48

8. its very nice
View Tutorial          By: keerthi at 2012-06-28 17:04:36

9. I get this error too, but my scrit doesint use mys
View Tutorial          By: Paulius at 2009-04-29 12:35:55

10. hi friends thank you very much for the code but th
View Tutorial          By: Surya at 2008-06-13 07:06:07