Embed SWING .JAR in Browser
Hey folks,
Got a small problem. I want to embed my Swing .JAR in my Browser and run it. All I get to see is a grey area, although it seems to load something for a couple of seconds.
The HTML code is as following:
HTML Code:
<html>
<head><title>Jass Client</title></head>
<body>
<applet code="jassclient.Main.class" name="Applet" archive="JassClient.jar" width="700" height="700">
Not working...
</applet>
</body>
</html>
And the Java Code:
Code :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jassclient;
import jassclient.display.GameGUI;
import engine.Game;
import engine.Gateway;
import java.applet.Applet;
import java.awt.Container;
import javax.swing.JApplet;
import javax.swing.SwingUtilities;
/**
*
* @author ruffy
*/
public class Main extends JApplet {
private static GameGUI gameGUI;
@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() {
GameGUI gameGUI = new GameGUI();
setContentPane(gameGUI);
//gameGUI = new GameGUI();
gameGUI.setVisible(true);
}
});
} catch (Exception e) {
System.err.println("createGUI didn't complete successfully");
}
}
}
Any help would be greatly appreciated!
Re: Embed SWING .JAR in Browser
Great question! I am having the same problem as you. My .jar executes fine, but the browser doesn't show the applet. I also have a test Applet that I coded which I exported to a .jar and it runs successfully in the browser. If anyone can help we would definitely appreciate it. BTW ventrol if you find the answer would you be so kind as to keep me informed :) Thanks so much,
Re: Embed SWING .JAR in Browser
Look at the browser's java console for error messages.