Well, the obvious advantage to WebStart is that the user can cache the application and not have to return to your site every time that they want to launch it. They can save it to their desktop, etc, etc, etc. I - typically - only use applets when they are an addition / part of the actual web site itself. I.e., it enhances the website / server a purpose for the site itself. I use WebStart when I want to use the web as my method of deploying a light-weight Desktop application or something similar. It sounds (given the little bit of information that you have provided) like WebStart is the way that you should go, but again that's hard to say without more details.
my program is a form for questions/feedback, and the typical user will only use it once. So it looks like maybe applet is the best way to go, but I can't get the applet to work. Here is my code:
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/*********************************************/
/* Program: formUI.java, Rev 05/26/07*/
/* Author: */
/* Digital Internet Productions.*/
/* This is the GUI for the form used*/
/* to save the text field.*/
/* Input: Text Field, Output: comment.txt*/
/*********************************************/
public class formUI extends javax.swing.JFrame {
public formUI() {
initComponents();
}
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
jLabel1.setText("Please Enter your questions and comments below");
jLabel2.setText("Name:");
jLabel3.setText("Email:");
jLabel4.setText("Question / Comment:");
jButton1.setText("Submit");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
});
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(146, 146, 146)
.addComponent(jButton1))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
.addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(210, 210, 210)))))
.addContainerGap(62, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 349, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLabel1)))
.addContainerGap(25, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(27, 27, 27)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
StringBuffer sb = new StringBuffer();
sb.append("Name: "+jTextField1.getText()+"\n");
sb.append("Email: "+jTextField2.getText()+"\n");
sb.append("Comment: "+jTextArea1.getText()+"\n\n");
writeToFile(sb.toString());
jOptionPane1.showMessageDialog(frame, "Your information has been submitted.", "Thank You!!", jOptionPane1.INFORMATION_MESSAGE);
System.exit(0);
}
private void writeToFile(String s) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter("C:\\Dono's Files\\Text Docs\\comment.txt",true));
out.write(s);
out.close();
} catch (IOException e) {
e.toString();
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new formUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JOptionPane jOptionPane1;
private javax.swing.JFrame frame;
// End of variables declaration
}
Since you've started with an applet, why not continue and see how far you can do?
Anyway, from the mailbag:
> I know that JAR files are needed to make a web app, but I don't know how to get those,
web apps (JSP/servlets) are part of the J2EE. So it suffices to download the sdk
for the J2EE
You also need a servlet container like Tomcat: http://tomcat.apache.org/
to run the web application.
> also what software would the users need to run the app.
They need a web browser, like Forefox or Internet Explorer.