如何instance variables
从匿名类的方法内部访问?
class Tester extends JFrame {
private JButton button;
private JLabel label;
//..some more
public Tester() {
function(); // CALL FUNCTION
}
public void function() {
Runnable r = new Runnable() {
@Override
public void run() {
// How do I access button and label from here ?
}
};
new Thread(r).start();
}
}