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. when i use this, the textarea automatically create
View Tutorial          By: gary at 2011-06-08 07:14:09

2. i am run this code changing the SMSC (ex:+9198860
View Tutorial          By: sknand13 at 2007-11-16 03:27:52

3. can u give a gud example on command line arguments
View Tutorial          By: shravan at 2010-04-09 23:11:18

4. Respected Sir:
i am murugan any java real

View Tutorial          By: murugan at 2012-04-12 05:15:16

5. THANKS you for having this site. it help me a lot
View Tutorial          By: fermilita at 2012-01-04 11:45:53

6. nice information, thanks dost.
View Tutorial          By: Bhargavi Menpara at 2013-02-12 08:11:23

7. Hi, I need the complete working code for recieving
View Tutorial          By: Issam at 2008-09-26 01:24:04

8. can you give me tutorial how to copy phonebook to
View Tutorial          By: rico at 2010-04-04 21:07:57

9. Thank you. This is really awesome... Helped us a l
View Tutorial          By: Shivakumar at 2012-09-12 15:23:21

10. programs are making the concept easy.its a nice pr
View Tutorial          By: veeru at 2010-05-12 22:10:25