-
Once we write a program eg: a JFrame .. we can see it in a appletviewer or browser... But if you want to give that application to multiple users what should you do ? Should you just give the class file or should you somehow create a exe file and give them like in Visual Basic ?
-
Cut the startup of the application from the implementation of it. You probably have something like:
public class MyApplication implements JFrame {
// ... application coding.
public static void main(String args) {
// .. startup code.
}
}
What you really want is ....
public class MyApplicationFrame implements JFrame {
// ... application coding.
MyApplicationFrame() {
// ... Startup code
}
}
public class MyApplication {
public static void main(String args) {
MyApplicationFrame maf = new MyApplicationFrame();
}
}
public class MyApplicationApplet extends JApplet {
// ... A simple applet with a "start" button
public void startGUI() {
// ... Run when the start button is hit.
MyApplicationFrame maf = new MyApplicationFrame();
}
}
In this manner you can start your GUI from applet or application as you desire.