nativewebbrowser.java
来自「一款即时通讯软件」· Java 代码 · 共 37 行
JAVA
37 行
package edu.ou.kmi.buddyspace.utils;
import javax.swing.JOptionPane;
public class NativeWebBrowser {
/** Goes to given URL - works only under Windows - opens external web browser. */
static public void launchURL(String url) {
try {
if (OSVersion.isWindowsNTPlatform()) {
String command = new String("cmd.exe /c start \"BuddySpace - browsing link\" \"" + url + "\"");
//System.out.println(command);
Process p = Runtime.getRuntime().exec(command);
p.waitFor();
}
else if (OSVersion.isWindows9xPlatform()) {
String command = new String("command.com /c start \"" + url + "\"");
//System.out.println(command);
Process p = Runtime.getRuntime().exec(command);
p.waitFor();
}
else
System.out.println("Sorry, no web browsing support for nonWin yet");
//htmlEditorPane.setPage(url);
} catch (Exception e) {
//System.out.println("Couldn't load the url: " + e.getMessage());
JOptionPane.showMessageDialog(null,
"Cannot open url " + url,
"Web browser error",
JOptionPane.ERROR_MESSAGE);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?