【发布时间】:2011-01-26 09:48:07
【问题描述】:
此方法在 JFrame 对象内部,我如何将该 JFrame 对象作为参数传递给其内部类中的方法? 我的代码是: 评论解释了我有兴趣做的事情:
公共无效运行时间(){
ActionListener action = new ActionListener(){
公共无效actionPerformed(ActionEvent e){
计数++;
text.setText(new Integer(count).toString());
而(计数==2012){
//我想传递持有这个而不是null的框架,怎么可能?
JOptionPane.showMessageDialog(null, "HelloEnd", "End of World", JOptionPane.INFORMATION_MESSAGE, new ImageIcon("explode.jpg"));
休息;
}
}
};
tr = new Timer(1000,action);
tr.start();
}
【问题讨论】:
标签: java class inheritance