how to implement a callback in runnable to update other swing class

Posted by wizztjh on Stack Overflow See other posts from Stack Overflow or by wizztjh
Published on 2010-12-26T07:32:25Z Indexed on 2010/12/26 7:54 UTC
Read the original article Hit count: 200

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about oop