How to add exception to actionPerformed?
I have code that looks like this, with the main panel using an action listener in a different class in the same file:
publicclass MyPanel
{
public MyPanel()
{
//Panel code
button.addActionListener(new MyButton());
}
}
privateclass MyButtonimplements ActionListener
{
publicvoid actionPerformed(ActionEvent e)
//I want to throw a FileNotFoundException here, but when
//I compile it, I get:
//actionPerformed in Panel.java cannot implement actionPerformed in
//java.awt.event.ActionListener; overridden method does not throw FileNotFoundException
{
Scanner scan =new Scanner(new File("Items.txt"));
}
}
Any help would be appreciated. Thanks

