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. How to download more than one files. If I use for
View Tutorial          By: Riyas at 2012-01-08 07:55:03

2. i m a student of Bahria university,Pakistan.and th
View Tutorial          By: Rao Waseem at 2011-05-14 12:55:53

3. why the java program must be written in side the c
View Tutorial          By: surendra at 2009-04-01 09:02:42

4. thank you..!!
really very helpful...

View Tutorial          By: sneha at 2012-01-30 18:01:16

5. Thanks so much!
View Tutorial          By: Viet at 2013-01-15 15:02:52

6. I deploy a project in apache tomcat and backend to
View Tutorial          By: satish at 2010-08-04 05:31:59

7. it is Marvelous example.
View Tutorial          By: princevijayakumar at 2010-08-04 07:56:33

8. Thank you. This was a very annoying problem unti
View Tutorial          By: CBL at 2009-03-02 02:52:00

9. the program does run thank you for that .....

View Tutorial          By: VIKRAM at 2007-03-12 13:34:24

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