I'm working on a simple inventory program using a Java applet that connects to a MySQL database. Program works fine if I just compile and run it from Netbeans, but it is throwing an exception once I add an applet wrapper.
The java console is only spitting out "createGUI didn't complete successfully" and not the stacktrace or exception message that I need for troubleshooting. What gives?
I've had TONS of trouble getting the html applet tag to work at all. Is this method antiquated?
Developing an Applet (The Java™ Tutorials > Deployment > Applets)
<html> <head> <title> Testing Page for Java Applet </title> </head> <body> <p>Begin body...</p> <applet code="sqlconnection.appletWrapper.class" width=400 height=400 archive="SQLConnection.jar> <hr> Replacement Text <hr> </applet> <p>End body...</p> </body> </html>
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package sqlconnection; /** * * @author Master */ import javax.swing.JApplet; import javax.swing.SwingUtilities; public class appletWrapper extends JApplet { //Called when this applet is loaded into the browser. @Override public void init() { //Execute a job on the event-dispatching thread; creating this applet's GUI. try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { createGUI(); } }); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); System.out.println(e.toString()); System.out.println("createGUI didn't complete successfully"); } } private void createGUI() { //Create and set up the content pane. System.out.println("inside createGUI"); MainPanel newContentPane = new MainPanel(); newContentPane.setOpaque(true); setContentPane(newContentPane); System.out.println("leaving createGUI"); } }