How to luanch a website with your defualt browser the easy and more efficient way
Classes Modified: most likly client.java
OS This Works for: All
Difficulty: 0/10
Why did i post this? all the other tuts were long and horible
first youll need to declare some packages
Code:
import java.io.IOException;
import java.lang.Object;
import java.awt.Desktop;
import java.net.URI;
and this very small method
Code:
public static void Site(String Url) {
Desktop d = Desktop.getDesktop();
try {
d.browse( new URI( Url ) );
} catch(Exception e) {}
}
what these will do is find your default browser and open up the website you wish to chose.
then under your button JItem w\e it is youd add this
Code:
Site("url goes here);
if it says it can not be applied to a static method take out the static from the method Site
have fun