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. help me in my final project about arrays
View Tutorial          By: grace at 2013-03-13 09:54:11

2. Hi, You need to place a control on your form

View Tutorial          By: Ranjit at 2010-02-09 02:29:40

3. what are the required equipments to run j2me
View Tutorial          By: messi at 2012-11-13 13:15:18

4. Hi Maybelline, This is the <a href="http:/
View Tutorial          By: Daniel Malcolm at 2008-08-21 06:57:31

5. what about (!isset)?? the isset with "!"
View Tutorial          By: bali web design at 2011-04-21 12:51:38

6. I find dis site very educating
View Tutorial          By: Kensho at 2009-05-09 05:18:57

7. hmmmmmm good
View Tutorial          By: Haritha chinnu at 2012-06-30 09:37:49

8. The smiple easy and best way is :)
--------

View Tutorial          By: Sandhya at 2012-06-21 06:08:25

9. example is ok, but plz increases the standard of e
View Tutorial          By: venky at 2009-05-19 01:29:04

10. good;Every one can understand
View Tutorial          By: seshu at 2011-04-26 05:11:09