【发布时间】:2013-03-24 18:28:59
【问题描述】:
必需:ActionListener
找到:EditMenuFunctions
原因:实际参数 EditMenuFunctions 无法转换为 ActionListener 按方法调用转换.\AFrame.java:56:错误:类中的方法 addActionListener AbstractButton 不能应用于给定类型;
refMenuBar.time_date.addActionListener(new EditMenuFunctions());
AMenuBar refMenuBar = new AMenuBar();
protected final JMenuItem time_date = new JMenuItem("Time / Date");
refMenuBar.time_date.addActionListener(new EditMenuFunctions());
class EditMenuFunctions 是我的类,其中包含 actionPerformed() 方法。我正在将 actionListener 添加到 class AFrame 中的 JMenuItem 并且我已经在 class AMenuBar 中创建了 JMenuItem
【问题讨论】: