java - How to access class inside a thread -
i trying following in gui class notifying registred observers.
public class gui extends javax.swing.jframe implements observer { public notimportantmethod() { t = new thread() { @override public void run() { (int = 1; <= 10; i++) { myobject.registerobserver(this); } } }; t.start(); } } it gives me error: incompatible types: cannot converted observer how can use this? know inside of run there context how access it?
this refers thread. should able call gui.this. more info, see here .
Comments
Post a Comment