[ suftApplet.java ]
import java.applet.*;import java.awt.*;
import java.awt.event.*;
import java.net.*;
/*
<applet code="surfApplet" height="500" width="500">
</applet>
*/
public class surfApplet extends Applet implements ActionListener
{
TextField tfURL;
Button bShowURL;
public void init()
{
tfURL = new TextField (30);
bShowURL = new Button ("Show Web");
bShowURL.addActionListener (this);
add (tfURL);
add(bShowURL);
}
public void actionPerformed (ActionEvent ae)
{
try
{
AppletContext ac = getAppletContext();
URL link=null;
link = new URL ( tfURL.getText() );
ac.showDocument (link, "_blank");
showStatus("By Pankaj Sharma");
}
catch (Exception ex) {}
}
public void paint(Graphics g)
{
showStatus("www.master-gtu.blogspot.com");
}
}
No comments:
Post a Comment