Tengo el siguiente codigo con el que abro una url en el navegadorpor defecto:
public void hyperlinkUpdate(HyperlinkEvent e){
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
try {
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
try {
desktop.browse(new URI(e.getURL().toString()));
}catch(URISyntaxException URI){System.err.println("error");}
} catch(IOException ioe) {System.err.println("error");
}
}
}
me gustaría poder elegir el navegador en el que abro la url por ejemplo mozilla o chrome....¿alguna idea?
He hallado la respuesta en otro foro... asi que por si a alguien le sirve:
public void hyperlinkUpdate(HyperlinkEvent e){
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
//METODO UNIVERSAL PARA ABRIR EL NAVEGADOR POR DEFECTO
/* java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
try {
try {
desktop.browse(new URI(e.getURL().toString()));
}catch(URISyntaxException URI){System.err.println("error");}
} catch(IOException ioe) {System.err.println("error");
} */
//METODO PARTICULAR PARA ABRIR LINK CON FIREFOX
try{
Process p = Runtime.getRuntime().exec("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"+" "+e.getURL().toString());
}catch(Exception e1){}
}
}