/*
*一坨其他代码
*/
/*
*检测url
*/
if (curUrl == null) {
// Check if the text value is a valid URL.
try {
curUrl = new URL(inputValue);
} catch (MalformedURLException e) {
if (inputValue.toLowerCase().startsWith("ftp.")) {
curUrl = new URL("ftp://" + inputValue);
} else if (inputValue.toLowerCase().startsWith("gopher.")) {
curUrl = new URL("gopher://" + inputValue);
} else if(inputValue.toLowerCase().startsWith("http.")){
curUrl = new URL("http://" + inputValue);
}
else{
curUrl = new URL(inputValue);
}
}
}
webBrowser.setURL(curUrl);