Is there a way I can pass values from HTML to a Swing Designer generated applet? (Using getParameter().)
It seems that getParameter doesn't work unless it's in the init() method of the applet. So I tried this:
- Code: Select all
import javax.swing.JApplet;
import java.awt.BorderLayout;
import javax.swing.JTextField;
// Created on 08-Jun-2004
// (c) Mike Kelly
// @author Mike Kelly
public class BBApplet3 extends JApplet {
private String uN = new String();
private String uR = new String();
public void init(){
uN = getParameter("userName");
uR = getParameter("userRole");
}
public BBApplet3() {
super();
getContentPane().setLayout(new BorderLayout());
{
final JTextField textField = new JTextField();
getContentPane().add(textField, BorderLayout.NORTH);
textField.setText(uN);
}
{
final JTextField textField = new JTextField();
getContentPane().add(textField, BorderLayout.SOUTH);
textField.setText(uR);
}
//
}
}
The fields passed by HTML don't show up. Is there a way to do this without breaking the Designer functionality?
Thanks,
M