While I can certainly show the contents of a web page in a JEditorPane, how do I launch the desktop's browser with the new URL?

John Zukowski

The JDesktop Integration Components (JDIC), available from https://jdic.dev.java.net, offers support for this:

import java.net.*;
import org.jdesktop.jdic.desktop.*;

public class LaunchURL {

  public static void main(String[] args) {
    try {
      Desktop.browse(new URL("http://www.jguru.com/"));
    } catch (MalformedURLException e){
      System.err.println("not today");
      e.printStackTrace();
    } catch (DesktopException e){
      e.printStackTrace();
    }
  }
}
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact