Thursday, September 12, 2013

Opening a URL in java

Do you want to launch a URL from your default browser maybe after a button is pressed.
Just attached these lines of code under the button action performed.

   import java.awt.Desktop;
   import java.net.*;
URI uri = new URI("http://moumie.org") ;
Desktop desk= Desktop.getDesktop();
desk.browse(uri);
And life goes on.

No comments:

Post a Comment