Well yes - look at the declaration of the method you're implementing:
void actionPerformed(ActionEvent e)
It isn't declared to throw any checked exceptions. So you can't add a checked exception such as IOException
with a throws
clause. You'll have to either handle the exception in your listener, or convert it to an unchecked exception and throw that.
(Your exception handling is already far from ideal - within the method, you catch IOException
and swallow it completely silently... failing to close the file in that case. You should close the reader in a finally block or using a try-with-resources statement if you're using Java 7, and you should at least log the exception, potentially telling the user about it. Continuing as if nothing had gone wrong is a really bad idea.)