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



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. hello,
i have to connect the crystal report

View Tutorial          By: shanmugaraj at 2010-03-03 04:08:30

2. you can use multiple switch statements depending o
View Tutorial          By: moshood at 2012-04-01 13:24:41

3. its work well , thanks for code , but if any body
View Tutorial          By: mary at 2007-12-16 07:10:58

4. tnx man that was short and well explained...
View Tutorial          By: jsf noob at 2012-02-02 13:24:12

5. hi all m getting following error ,
can anyo

View Tutorial          By: raj at 2008-11-04 21:46:12

6. When stateless bean not maintains any state and no
View Tutorial          By: Mallikarjun at 2015-09-18 15:42:46

7. its a good example
View Tutorial          By: Sonal at 2009-03-25 08:35:10

8. Your code will not execute using above main method
View Tutorial          By: Gajanan Patil at 2012-05-09 04:42:29

9. sir, could you please tell me about minimum and ma
View Tutorial          By: priya dwivedi at 2012-01-04 15:01:03

10. Thanks for help
View Tutorial          By: Asha at 2014-12-20 08:25:48