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. Hi,

Your COM port is currently in u

View Tutorial          By: Ramlak at 2008-04-14 07:29:55

2. Wow, Problem resolved ....
View Tutorial          By: Muhammad Farrukh at 2011-08-29 21:02:09

3. Sometimes java do support operator overloading as
View Tutorial          By: Gunjan Srivastava at 2011-07-06 09:14:00

4. //EXAMPLE OF NESTED IF*****
//FIND OUT BIGE

View Tutorial          By: Amitava Misra at 2009-11-03 06:11:33

5. Is so easy work with FacesContext. For me, the get
View Tutorial          By: Fred at 2009-03-11 08:42:59

6. hi.. how can i extrate day, month, year from date
View Tutorial          By: avkash at 2010-10-03 05:19:58

7. why 27's example is prone to a deadlock ? when pro
View Tutorial          By: kaka at 2011-08-14 00:59:41

8. hi! i want to know about how database createed in
View Tutorial          By: kundan at 2010-05-19 05:03:33

9. Answer for comment 5
this loop is work infi

View Tutorial          By: salman at 2013-03-10 07:30:53

10. very simple example.....................
View Tutorial          By: kajal at 2015-08-22 09:28:16