//this is my thread:
public class threadMoveRight implements Runnable{
Storeroom sto = new Storeroom();
String url;
Image image1;
boolean flag;

public threadMoveRight(String purl,Image pImage) {
this.url = purl;
this.image1 = pImage;
}

public void run() {
searchData();
flag = true;
}

}
//and after the user press on right he go to this code :
if (sto.doINeedConection){
while (sto.flag==false){
sleep();
}
}
repaint();
//the result:
//the program stay a lot of time in the sleep

??????????

What is your question/problem?

the program stay in the loop and i want that the program will calc the data and go to the internet but it stock....

hint: which flag are you setting and which flag are you checking?

do you run the thread?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.