假设我有类似的东西:
Applet myApplet = new MyApplet();
如何以出现新窗口的方式调用该小程序,并且我仍然能够从该范围访问该 MyApplet 实例?
一般来说,我希望能够编写这样的代码:
class Runner {
public static void main(String[] args) {
new Runner().run();
}
void run() {
MyApplet myApplet = new MyApplet();
myApplet.init();
myApplet.doSomething();
}
}
我该怎么做?