I need help with calling methods from within a class of a Java or a Java applet .jar file locally stored. The idea behind using HTML as interface is that I want to make a quick good looking GUI using jQuery and link it to other classes for my application.
A basic java applet:
package appletHW;
import java.applet.Applet;
import javax.swing.*;
public class HWapplet extends Applet {
static JFrame frame;
/**
* @param args
*/
public void init() {
System.out.println("Hello world!");
JOptionPane.showMessageDialog(frame,
"Eggs are not supposed to be green.");
}
}
I hope nothing's wrong with the above code. I am new to all of this! :) I created a jar file of the above class named as aHW.jar
A HTML page for my interface:
<head>
<title>INTERFACE</title>
</head>
<body>
<object
classid="java:appletHW.HWapplet.class"
type="application/x-java-applet"
archive="aHW.jar">
</object>
<!--not sure of the above code... -->
<form action="">
<input type="button" value="a" onclick="init()">
</BR>
</BR>
</BR>
<input type="button" value="b">
</BR>
</BR>
</BR>
<input type="button" value="c">
</form>
</body>
Could someone please help me with the above sample codes? I am new to all this and I would really appreciate some hand holding guidance on accomplishing the same.
Regards, Archit
JFramedirectly off the site & you will save lots of trouble. 2) If continuing with the applet, theJFrameis not necessary. a) Without setting the frame location, you might as well handnullas the parent of theJOptionPane. b) The applet itself could be used as the parent component.3.2(or4.01 Transitional) & use theappletelement instead ofobject. Validate that HTML. For deployment, write the applet(/object/embed) element using deployJava.js. Most programmers have no respect for HTML and presume that 'any old crap' will work. Don't presume that, validate it then test it in a number of browsers.