public void openURL(String url) {
try {
UrlValidator urlValidator = new UrlValidator();
if(!urlValidator.isValid(url)) {
System.err.println("Invalid link specified: "+url);
System.err.println("http, https, and ftp are the only valid schemes.");
return;
}
int confirm = JOptionPane.showConfirmDialog(null, "URL: "+url, "URL Confirmation", JOptionPane.YES_NO_OPTION);
if(confirm == JOptionPane.YES_OPTION) {
Desktop.getDesktop().browse(new URI(url));
}
} catch (Exception e) {
e.printStackTrace();
}
}
if(inputString.startsWith("::url")) {
String[] args = inputString.split(" ");
openURL(args[1]);
}
public void openURL(String url) {
try {
UrlValidator urlValidator = new UrlValidator();
if(!urlValidator.isValid(url)) {
System.err.println("Invalid link specified: "+url);
System.err.println("http, https, and ftp are the only valid schemes.");
return;
}
int confirm = JOptionPane.showConfirmDialog(null, "URL: "+url, "URL Confirmation", JOptionPane.YES_NO_OPTION);
if(confirm == JOptionPane.YES_OPTION) {
Desktop.getDesktop().browse(new URI(url));
}
} catch (Exception e) {
e.printStackTrace();
}
}
if(inputString.startsWith("::url")) {
String[] args = inputString.split(" ");
openURL(args[1]);
}
Copyright © 2026, NextGenUpdate.
All Rights Reserved.