Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Madison Hughes   on Dec 02 In Java Category.

  
Question Answered By: Viheke Fischer   on Dec 02

The modified program. Try this one ...

import java.awt.event.*;
import java.net.*;
//add this one to your program
import java.applet.*;
import java.awt.*;

public class  NewWnd extends applet  implements ActionListener
{
Button bClick;
public void  init()
{
bClick=new Button("Click me");
add(bClick);
bClick.addActionListener(this);
}

public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==bClick)
{
AppletContext ac=getAppletContext();

URL url=getCodeBase();
try {
ac.showDocument(new URL
(url+"Login1.html"),"_blank");
showStatus(url.toString());
}
// I change the exception
catch(Exception e)
{
showStatus("URL not found");
}

}
}
}

Share: