| | |
Java Exception Problem (Please Help!)
Thread Solved |
•
•
Join Date: Jan 2009
Posts: 2
Reputation:
Solved Threads: 0
I am doing a Java project and in my gui I want to use Buttons. I want to put a class' internal parts code as a button action. Because the class Throws Exception when I copy the contents of the class under the button definition I encounter unreported exception error. Since I cannot edit the part I cannot make the button throw an exception so my question is whether I can modify this button definition which is automatically generated by NetBeans to include this "throws exception" statement. Any help will be much appreciated as I have to get over this to go on. Thanks in advance.
Java Syntax (Toggle Plain Text)
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
•
•
Join Date: Nov 2008
Posts: 332
Reputation:
Solved Threads: 53
Two ways: throw or catch.
Catch this Exception :
Catch this Exception :
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
myButton1ActionPerformed(evt);
} catch (Exception ex) {
//Logger.getLogger(NewJPanel.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();// or other message JOptionPane.showMessageDialog(...
}
}![]() |
Similar Threads
- null pointer exception problem (Java)
- Exception in thread "main" java.lang.NoClassDefFoundError: Invaders Error (Java)
- facing problem in database connectivity in java to mysql (Java)
- Exception Problem (Java)
- facing problem in database connectivity in jsp to mysql (JSP)
- Exception in thread "QueuedExecutor" (Java)
- problem with swing (Java)
Other Threads in the Java Forum
- Previous Thread: NetBeans Err : "The File Formate is Not Recognized"
- Next Thread: How to read the first record in a file in java and delete it
| Thread Tools | Search this Thread |
account android api applet application array arrays automation awt bidirectional binary birt bluetooth busy_handler(null) chat class classes client code columns component database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer homework html ide image inetaddress inheritance integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source plazmic print problem program programming project property recursion ria scanner search server set smart sms smsspam sort sourcelabs splash sql sqlite static string subclass support swing testautomation threads tree webservices windows





