| | |
Action Event help
Thread Solved |
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.
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.
•
•
Join Date: Jun 2004
Posts: 2,108
Reputation:
Solved Threads: 18
catch the exception:
Java Syntax (Toggle Plain Text)
public void actionPerformed(ActionEvent ae) { try { methodcall(); } catch(IOException ioe) { } }
![]() |
Similar Threads
- event handling (Java)
- GridBag layout problems. (Java)
- [MERGED]can anybody help me with this problem; snake game (Java)
- something is wrong (Java)
- problem in java cobe (Java)
- Mortgage Calculation (Java)
Other Threads in the Java Forum
- Previous Thread: audio mobile player
- Next Thread: How to create an exe for a Java application
Views: 2588 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Java
access add android applet application arguments array arraylist arrays build c++ chat class classes client code combobox component convert coordinates data database design desktop detection draw eclipse error event exception file filei/o game givemetehcodez graphics gridlayout gui helpwithhomework html ide image images inheritance input integer interface j2me java jframe jpanel jtable jtextarea julia key lazy linked linked-list list loop looping method methods mobile netbeans newbie node number object objects output page parameter pattern problem program programming project read regex remove return robot scanner screen search server service set size sms source sql string swing text text-file threads timer tree url






