Action Event help

Thread Solved

Join Date: Jul 2005
Posts: 4,845
Reputation: joshSCH is on a distinguished road 
Solved Threads: 10
joshSCH's Avatar
joshSCH joshSCH is offline Offline
Banned

Action Event help

 
0
  #1
Sep 3rd, 2005
Hi, I've created a GUI program that has JButtons for like a menu. I am trying to get the action listener to do a whole other method.
EXample:

view.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{

menu();
System.exit(0);

}

But, It will not go to the method. It displays an error message that says: "unreported exception java.io.IOException; must be caught or declared to be thrown"
I am unsure if I must throw an IOException, or even how to throw and actionListener.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Action Event help

 
0
  #2
Sep 3rd, 2005
catch the exception:
  1. public void actionPerformed(ActionEvent ae)
  2. {
  3. try
  4. {
  5. methodcall();
  6. }
  7. catch(IOException ioe)
  8. {
  9. }
  10. }
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4,845
Reputation: joshSCH is on a distinguished road 
Solved Threads: 10
joshSCH's Avatar
joshSCH joshSCH is offline Offline
Banned

Re: Action Event help

 
0
  #3
Sep 3rd, 2005
that worked perfectly!! thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Action Event help

 
0
  #4
Sep 3rd, 2005
Originally Posted by joshSCH
that worked perfectly!! thanks
No problem, just glad to help!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 2588 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC