how to implement a callback in runnable to update other swing class
- by wizztjh
I have a thread like this
public class SMS {
class Read implements Runnable {
Read(){
Thread th = new Thread(this);
th.start();
}
@Override
public void run() {
// TODO Auto-generated method stub
while (true){
Variant SMSAPIReturnValue = SMSAPIJava.invoke("ReadSMS");
if (SMSAPIReturnValue.getBoolean()){
String InNumber = SMSAPIJava.getPropertyAsString("MN");
String InMessage = SMSAPIJava.getPropertyAsString("MSG");
}
}
}
}
}
How do I update the message to another GUI class in the same package(I understand how to put nested class to another package ....). Should I implement a callback function in SMS class? But how? Or should I pass in the Jlabel into the class?