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. all of codes of t-C++ ide, it is applicable to use
View Tutorial          By: jonard at 2009-06-05 20:41:39

2. Good one ! and simple tutorial
View Tutorial          By: Sim at 2011-02-24 01:57:53

3. Session Bean = client data is maintained upto pred
View Tutorial          By: Chetankumar at 2012-05-19 11:12:17

4. Thanks heaps, I had the file already there but it
View Tutorial          By: Jb at 2009-05-14 08:13:08

5. Sir, can you give me an example of Isalnum in java
View Tutorial          By: Angeline at 2011-07-13 06:43:54

6. can't build the 2nd code in netbeans,here is the
View Tutorial          By: arshavin at 2010-04-14 23:19:33

7. You may add STAX parser example also to complete t
View Tutorial          By: Satyam Jaiswal at 2014-11-25 05:48:59

8. i don't understand the input attributes can u plea
View Tutorial          By: dhanalakshmi at 2011-05-05 07:10:25

9. I wont to know about every thing of java
View Tutorial          By: susantha at 2009-10-11 09:35:40

10. return type doesn't influence the overloading. Onl
View Tutorial          By: Shekhar at 2010-05-17 01:22:04