This example is part of an applet. If the "conex" button is pressed, it opens a new browser window, for the given url.
public void actionPerformed(ActionEvent e)
{
String comanda=e.getActionCommand();
if (comanda.equals("conex"))
{
String address=t.getText();
// eg.
http://www.altavista.com try {
URL url = new URL(address);
AppletContext context = getAppletContext();
context.showDocument(url);
} catch(MalformedURLException exc)
{ System.out.println("URL wrong !!!\n"); }
}
}