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. Helpful..
View Tutorial          By: syam at 2009-12-29 07:14:05

2. could you send me a code for a music video mobile
View Tutorial          By: Christian at 2009-08-28 23:03:45

3. Hi,
I have problem of calling javascript fu

View Tutorial          By: Shakti Prasad Priyakumar at 2008-06-06 06:11:52

4. plz any one send me the code for sending and recei
View Tutorial          By: ankush at 2013-09-20 07:47:27

5. Thank you sir.
View Tutorial          By: Balan at 2008-09-02 22:16:56

6. The !isset() is basically checking if the string i
View Tutorial          By: Bijan at 2012-09-21 20:49:41

7. very easy to understand ... a quite a good example
View Tutorial          By: Dinesh at 2012-09-22 18:19:45

8. This is awesum !!!
easy to understand ....

View Tutorial          By: Sud at 2011-01-19 08:37:55

9. good tutorial
View Tutorial          By: mohang at 2011-12-24 05:24:56

10. Nice explanation. And a good example to back it up
View Tutorial          By: fazil at 2009-07-29 00:32:03