Hi guys,
I am trying to write an applet to put on a web document at work. My users all have IE using the default Microsoft JVM. I wrote a basic applet to display a new window based on a choice from a list box, and it is not displaying. Can you tell me what I might have to do to get it to display without having to have the java plug in installed on the target PC's?
Here is the code, very simple stuff.
Thanks.
Nick
I am trying to write an applet to put on a web document at work. My users all have IE using the default Microsoft JVM. I wrote a basic applet to display a new window based on a choice from a list box, and it is not displaying. Can you tell me what I might have to do to get it to display without having to have the java plug in installed on the target PC's?
Here is the code, very simple stuff.
Code:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.net.*;
/*
<applet code = "RejectApplet.class"
width = 300 height = 300>
</applet>
*/
public class RejectApplet extends Applet implements ActionListener
{
Panel p1;
Panel p2;
Label label;
URL url;
List l1;
public void init()
{
setLayout(new GridLayout(2,1,5,5));
l1 = new List();
l1.addActionListener(this);
p1 = new Panel();
p2 = new Panel();
label = new Label("Choose an option");
l1.add("Add a printer");
p1.add(label);
p2.add(l1);
add(p1);
add(p2);
}
public void actionPerformed(ActionEvent ie)
{
String command = ie.getActionCommand();
System.out.println(command);
if(command.equals("Add a printer"))
{
AppletContext ac = getAppletContext();
try{
url = new URL(getDocumentBase(),"Addprnt.html");
}catch( MalformedURLException m)
{
System.out.println("Not a valid url");
}
ac.showDocument(url,"blank");
}
}
}
Thanks.
Nick