netscape.java

来自「一个使用的搜索引擎」· Java 代码 · 共 42 行

JAVA
42
字号
package ir.utilities;import java.io.*;import java.lang.*;/**  * Utilities for displaying a URL or local file in the current Netscape * window using "netscape -remote".  User must have netscape running. * * @author Ray Mooney*/public class Netscape{    /** Make netscape display a given URL */    public static void display(String url) {	String[] cmd = new String[3];	cmd[0] = "netscape";	cmd[1] = "-remote";	cmd[2] = "openURL(" + url + ")";	try {	    Runtime.getRuntime().exec(cmd);	}	catch (IOException e) {	    System.out.println("Unable to run `netscape -remote' process.");		}    }    /** Make netscape display a given file */    public static void display(File file)  {	display("file:" + file.getAbsolutePath());    }    /** Test interface */    public static void main(String[] args) throws IOException {	String name = args[0];	File file = new File(name);	System.out.println("\nDisplaying: " + file.getAbsolutePath());	display(file);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?