Lemmy Danger: 2 links gleichzeitig

Beitrag lesen

Guude!

Ausnahmsweise gibt's jetzt auch mal den kompletten Code ;-)

import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.swing.*;

public class ZweiLinks extends JApplet implements ActionListener {

public void init(){
  Container cp = getContentPane();
  JButton link = new JButton("Zwei Links gleichzeitig");
  link.addActionListener(this);
  cp.add(link);
 }

public void actionPerformed(ActionEvent ae){
  URL firstURL =null, secondURL=null;
  try{
   firstURL = new URL("http://www.link1.de");
   secondURL = new URL("http://www.link2.de");
  }
  catch(MalformedURLException mue){
   System.out.println("URL error: "+mue);
  }
  getAppletContext().showDocument(firstURL, "_blank");
  getAppletContext().showDocument(secondURL, "_blank");
 }
}

LG ausm Hesseland
Lemmy