我已经获得了实现保存操作的代码,但是当我将代码放入时出现错误:
类 saveAction 的非法修饰符;只允许抽象或最终。
代码:
protected void initialiseActions(){
// TODO: initalise your actions here
public class SaveAction extends AbstractAction{
public SaveAction(String text, ImageIcon icon, String desc, Integer mnemonic){
super(text, icon);
putValue(SHORT_DESCRIPTION, desc);
putValue(MNEMONIC_KEY, mnemonic);
}
public void actionPerformed(ActionEvent e){
// Just print out a message for now.
System.out.println("Save");
}
}
Action saveAction = new SaveAction("Save", new ImageIcon("img/save.png"), "Save the image",
KeyEvent.VK_S);
}
任何帮助,将不胜感激。谢谢