亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? browser.java

?? Gmail API for Java 一個gmail信箱的客戶端
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/*
 * Control a web browser from your java application.
 * Copyright (C) 2001-2002 Stephen Ostermiller
 * http://ostermiller.org/contact.pl?regarding=Java+Utilities
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * See COPYING.TXT for details.
 */
package com.Ostermiller.util;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Vector;
import java.util.prefs.Preferences;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 * Allows URLs to be opened in the system browser on Windows and Unix.
 * More information about this class is available from <a target="_top" href=
 * "http://ostermiller.org/utils/Browser.html">ostermiller.org</a>.
 *
 * @author Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities
 * @since ostermillerutils 1.00.00
 */
public class Browser {

	/**
	 * The dialog that allows user configuration of the options for this class.
	 *
	 * @since ostermillerutils 1.00.00
	 */
	protected static BrowserDialog dialog;

	/**
	 * Locale specific strings displayed to the user.
	 *
	 * @since ostermillerutils 1.00.00
	 */
	protected static ResourceBundle labels = ResourceBundle.getBundle("com.Ostermiller.util.Browser",  Locale.getDefault());

	/**
	 * Set the locale used for getting localized
	 * strings.
	 *
	 * @param locale Locale used to for i18n.
	 *
	 * @since ostermillerutils 1.00.00
	 */
	public static void setLocale(Locale locale){
		labels = ResourceBundle.getBundle("com.Ostermiller.util.Browser",  locale);
	}

	/**
	 * A list of commands to try in order to display the url.
	 * The url is put into the command using MessageFormat, so
	 * the URL will be specified as {0} in the command.
	 * Some examples of commands to try might be:<br>
	 * <code>rundll32 url.dll,FileProtocolHandler {0}</code></br>
	 * <code>netscape {0}</code><br>
	 * These commands are passed in order to exec until something works
	 * when displayURL is used.
	 *
	 * @since ostermillerutils 1.00.00
	 */
	public static String[] exec = null;

	/**
	 * Determine appropriate commands to start a browser on the current
	 * operating system.  On windows: <br>
	 * <code>rundll32 url.dll,FileProtocolHandler {0}</code></br>
	 * On other operating systems, the "which" command is used to
	 * test if Mozilla, netscape, and lynx(xterm) are available (in that
	 * order).
	 *
	 * @since ostermillerutils 1.00.00
	 */
	public static void init(){
		exec = defaultCommands();
	}

	/**
	 * Retrieve the default commands to open a browser for this system.
	 *
	 * @since ostermillerutils 1.00.00
	 */
	public static String[] defaultCommands(){
		String[] exec = null;
		if ( System.getProperty("os.name").startsWith("Windows")){
			exec = new String[]{
				"rundll32 url.dll,FileProtocolHandler {0}",
			};
		} else if (System.getProperty("os.name").startsWith("Mac")){
			Vector browsers = new Vector();
			try {
				Process p = Runtime.getRuntime().exec("which open");
				if (p.waitFor() == 0){
					browsers.add("open {0}");
				}
			} catch (IOException e){
			} catch (InterruptedException e){
			}
			if (browsers.size() == 0){
				exec = null;
			} else {
				exec = (String[])browsers.toArray(new String[0]);
			}
		} else {
			Vector browsers = new Vector();
			try {
				Process p = Runtime.getRuntime().exec("which firebird");
				if (p.waitFor() == 0){
					browsers.add("firebird -remote openURL({0})");
					browsers.add("firebird {0}");
				}
			} catch (IOException e){
			} catch (InterruptedException e){
			}try {
				Process p = Runtime.getRuntime().exec("which mozilla");
				if (p.waitFor() == 0){
					browsers.add("mozilla -remote openURL({0})");
					browsers.add("mozilla {0}");
				}
			} catch (IOException e){
			} catch (InterruptedException e){
			}
			try {
				Process p = Runtime.getRuntime().exec("which opera");
				if (p.waitFor() == 0){
					browsers.add("opera -remote openURL({0})");
					browsers.add("opera {0}");
				}
			} catch (IOException e){
			} catch (InterruptedException e){
			}
			try {
				Process p = Runtime.getRuntime().exec("which galeon");
				if (p.waitFor() == 0){
					browsers.add("galeon {0}");
				}
			} catch (IOException e){
			} catch (InterruptedException e){
			}
			try {
				Process p = Runtime.getRuntime().exec("which konqueror");
				if (p.waitFor() == 0){
					browsers.add("konqueror {0}");
				}
			} catch (IOException e){
			} catch (InterruptedException e){
			}
			try {
				Process p = Runtime.getRuntime().exec("which netscape");
				if (p.waitFor() == 0){
					browsers.add("netscape -remote openURL({0})");
					browsers.add("netscape {0}");
				}
			} catch (IOException e){
			} catch (InterruptedException e){
			}
			try {
				Process p = Runtime.getRuntime().exec("which xterm");
				if (p.waitFor() == 0){
					p = Runtime.getRuntime().exec("which lynx");
					if (p.waitFor() == 0){
						browsers.add("xterm -e lynx {0}");
					}
				}
			} catch (IOException e){
			} catch (InterruptedException e){
			}
			if (browsers.size() == 0){
				exec = null;
			} else {
				exec = (String[])browsers.toArray(new String[0]);
			}
		}
		return exec;
	}

	/**
	 * Save the options used to the given properties file.
	 * Property names used will all start with com.Ostermiller.util.Browser
	 * Properties are saved in such a way that a call to load(props); will
	 * restore the state of this class.
	 * If the default commands to open a browser are being used then
	 * they are not saved in the properties file, assuming that the user
	 * will want to use the defaults next time even if the defaults change.
	 *
	 * @param props properties file to which configuration is saved.
	 *
	 * @since ostermillerutils 1.00.00
	 */
	public static void save(Properties props){
		boolean saveBrowser = false;
		if (Browser.exec != null && Browser.exec.length > 0){
			String[] exec = Browser.defaultCommands();
			if (exec != null && exec.length == Browser.exec.length){
				for (int i=0; i<exec.length; i++){
					if (!exec[i].equals(Browser.exec[i])){
						saveBrowser = true;
					}
				}
			} else {
				saveBrowser = true;
			}
		}
		if (saveBrowser){
			StringBuffer sb = new StringBuffer();
			for (int i=0; Browser.exec != null && i < Browser.exec.length; i++){
				sb.append(Browser.exec[i]).append('\n');
			}
			props.put("com.Ostermiller.util.Browser.open", sb.toString());
		} else {
			props.remove("com.Ostermiller.util.Browser.open");
		}
	}
	
	public static void save(Preferences prefs){
		boolean saveBrowser = false;
		if (Browser.exec != null && Browser.exec.length > 0){
			String[] exec = Browser.defaultCommands();
			if (exec != null && exec.length == Browser.exec.length){
				for (int i=0; i<exec.length; i++){
					if (!exec[i].equals(Browser.exec[i])){
						saveBrowser = true;
					}
				}
			} else {
				saveBrowser = true;
			}
		}
		if (saveBrowser){
			StringBuffer sb = new StringBuffer();
			for (int i=0; Browser.exec != null && i < Browser.exec.length; i++){
				sb.append(Browser.exec[i]).append('\n');
			}
			prefs.put("com.Ostermiller.util.Browser.open", sb.toString());
		} else {
			prefs.remove("com.Ostermiller.util.Browser.open");
		}
	}


	/**
	 * Load the options for this class from the given properties file.
	 * This method is designed to work with the save(props) method.  All
	 * properties used will start with com.Ostermiller.util.Browser.  If
	 * no configuration is found, the default configuration will be used.
	 * If this method is used, a call to Browser.init(); is not needed.
	 *
	 * @param props properties file from which configuration is loaded.
	 *
	 * @since ostermillerutils 1.00.00
	 */
	public static void load(Properties props){
		if (props.containsKey("com.Ostermiller.util.Browser.open")){
			java.util.StringTokenizer tok = new java.util.StringTokenizer(props.getProperty("com.Ostermiller.util.Browser.open"), "\r\n", false);
			int count = tok.countTokens();
			String[] exec = new String[count];
			for (int i=0; i < count; i++){
				exec[i] = tok.nextToken();
			}
			Browser.exec = exec;
		} else {
			Browser.init();
		}
	}
	
	public static void load(Preferences prefs){
		if (!prefs.get("com.Ostermiller.util.Browser.open","NOT SET").equals("NOT SET")){
			java.util.StringTokenizer tok = new java.util.StringTokenizer(prefs.get("com.Ostermiller.util.Browser.open","error loading prefs"), "\r\n", false);
			int count = tok.countTokens();
			String[] exec = new String[count];
			for (int i=0; i < count; i++){
				exec[i] = tok.nextToken();
			}
			Browser.exec = exec;
		} else {
			Browser.init();
		}
	}
	
	
	/**
	 * Display a URL in the system browser.
	 *
	 * Browser.init() should be called before calling this function or
	 * Browser.exec should be set explicitly.
	 *
	 * For security reasons, the URL will may not be passed directly to the
	 * browser as it is passed to this method.  The URL may be made safe for
	 * the exec command by URLEncoding the URL before passing it.
	 *
	 * @param url the url to display
	 * @throws IOException if the url is not valid or the browser fails to star
	 *
	 * @since ostermillerutils 1.00.00
	 */
	public static void displayURL(String url) throws IOException {
		if (exec == null || exec.length == 0){
			if (System.getProperty("os.name").startsWith("Mac")){
				boolean success = false;
			try {
				Class nSWorkspace;
					if (new File("/System/Library/Java/com/apple/cocoa/application/NSWorkspace.class").exists()){
						 // Mac OS X has NSWorkspace, but it is not in the classpath, add it.
						 ClassLoader classLoader = new URLClassLoader(new URL[]{new File("/System/Library/Java").toURL()});
						 nSWorkspace = Class.forName("com.apple.cocoa.application.NSWorkspace", true, classLoader);
					} else {
						 nSWorkspace = Class.forName("com.apple.cocoa.application.NSWorkspace");
					}
					Method sharedWorkspace = nSWorkspace.getMethod("sharedWorkspace", new Class[] {});
					Object workspace = sharedWorkspace.invoke(null, new Object[] {});
					Method openURL = nSWorkspace.getMethod("openURL", new Class[] {Class.forName("java.net.URL")});
					success = ((Boolean)openURL.invoke(workspace, new Object[] {new java.net.URL(url)})).booleanValue();
				//success = com.apple.cocoa.application.NSWorkspace.sharedWorkspace().openURL(new java.net.URL(url));
			} catch (Exception x) {}
				if (!success){
					try {
						 Class mrjFileUtils = Class.forName("com.apple.mrj.MRJFileUtils");
						 Method openURL = mrjFileUtils.getMethod("openURL", new Class[] {Class.forName("java.lang.String")});
						 openURL.invoke(null, new Object[] {url});
						 //com.apple.mrj.MRJFileUtils.openURL(url);
					} catch (Exception x){
						 System.err.println(x.getMessage());
						 throw new IOException(labels.getString("failed"));
					}
				}
			} else {
				throw new IOException(labels.getString("nocommand"));
			}
		} else {
			// for security, see if the url is valid.
			// this is primarily to catch an attack in which the url
			// starts with a - to fool the command line flags, bu
			// it could catch other stuff as well, and will throw a
			// MalformedURLException which will give the caller of this
			// function useful information.
			new URL(url);
			// escape any weird characters in the url.  This is primarily
			// to prevent an attacker from putting in spaces
			// that might fool exec into allowing
			// the attacker to execute arbitrary code.
			StringBuffer sb = new StringBuffer(url.length());
			for (int i=0; i<url.length(); i++){
				char c = url.charAt(i);
				if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久三级国产网站| 欧美午夜视频网站| 亚洲国产另类av| 欧美精品一区二区三区蜜桃| 色88888久久久久久影院按摩| 美女视频黄a大片欧美| 一区二区三区在线免费| 久久蜜臀中文字幕| 在线不卡免费av| 一本大道av伊人久久综合| 久久99久久精品| av一二三不卡影片| 一区二区三区成人在线视频| 欧美mv日韩mv| 国产欧美日韩久久| 久久久噜噜噜久久人人看 | 亚洲三级小视频| 99久久伊人网影院| 丝袜美腿高跟呻吟高潮一区| 国产精品乱码一区二三区小蝌蚪| 911精品国产一区二区在线| 不卡的av电影| 国产精品小仙女| 美女网站在线免费欧美精品| 亚洲综合男人的天堂| 国产精品乱人伦一区二区| 久久久高清一区二区三区| 欧美一级高清片| 91麻豆精品国产91久久久使用方法 | 春色校园综合激情亚洲| 午夜视频在线观看一区二区| 亚洲欧美色图小说| 国产偷国产偷精品高清尤物 | 国产精品一区二区三区网站| 蜜臀av一区二区在线免费观看 | 成人黄色av网站在线| 国产剧情一区在线| 国内精品写真在线观看| 精品午夜久久福利影院| 久久99久久99| 国产成人综合在线播放| 国产精品888| 国产91在线看| 成人国产精品免费网站| av亚洲精华国产精华| 99re热视频精品| 色婷婷综合久久久久中文一区二区| 9久草视频在线视频精品| 99在线精品免费| 91行情网站电视在线观看高清版| 色欲综合视频天天天| 日本韩国视频一区二区| 欧美三片在线视频观看 | 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 午夜视频一区在线观看| 日本一区中文字幕| 蜜桃av一区二区在线观看| 久久精品国产99国产| 国内精品国产成人国产三级粉色 | 欧美性视频一区二区三区| 精品视频一区三区九区| 91精品国产综合久久小美女| 精品日韩av一区二区| 国产精品理伦片| 亚洲一二三四区不卡| 蜜臀a∨国产成人精品| 国产91色综合久久免费分享| 99久久99久久免费精品蜜臀| 国产精品网曝门| 一区二区三区电影在线播| 美腿丝袜在线亚洲一区| 国产成+人+日韩+欧美+亚洲 | 精品国一区二区三区| 亚洲国产精品国自产拍av| 亚洲精品一二三区| 亚洲超丰满肉感bbw| 久色婷婷小香蕉久久| 国产电影精品久久禁18| 不卡免费追剧大全电视剧网站| 色婷婷久久99综合精品jk白丝| 欧美日韩国产精选| 久久精品水蜜桃av综合天堂| 亚洲品质自拍视频网站| 久久电影网电视剧免费观看| www.日韩精品| 日韩无一区二区| 亚洲日本在线a| 蜜臀va亚洲va欧美va天堂| 91麻豆精品在线观看| 精品伦理精品一区| 亚洲视频免费在线观看| 久久激情五月激情| 欧美性色综合网| 欧美激情综合在线| 狂野欧美性猛交blacked| 色综合久久久网| 2023国产精华国产精品| 亚洲自拍另类综合| 国产a区久久久| 日韩欧美在线一区二区三区| 亚洲精选免费视频| 国产成人免费在线观看| 欧美一区二区在线播放| 欧美刺激脚交jootjob| 亚洲青青青在线视频| 国产亚洲午夜高清国产拍精品 | 亚洲风情在线资源站| 国产成人精品网址| 日韩欧美一区中文| 亚洲一区二区三区四区不卡| 成人美女视频在线观看| 精品精品欲导航| 日韩电影免费在线| 欧洲av一区二区嗯嗯嗯啊| 国产精品天美传媒| 国产伦理精品不卡| 欧美大尺度电影在线| 日日欢夜夜爽一区| 欧美熟乱第一页| 亚洲情趣在线观看| 91啪亚洲精品| 综合激情成人伊人| 不卡一区二区在线| 国产欧美日韩三区| 国产精品系列在线播放| 久久青草欧美一区二区三区| 久久se这里有精品| 日韩免费在线观看| 激情图区综合网| 精品国产一区二区三区四区四 | 国产一区二区久久| 日韩毛片高清在线播放| 精品91自产拍在线观看一区| 国产精品理论片| 成人国产一区二区三区精品| 欧美激情一二三区| www.亚洲免费av| 国产精品剧情在线亚洲| 大胆亚洲人体视频| 国产精品美女www爽爽爽| 白白色 亚洲乱淫| 自拍偷拍欧美精品| 在线观看区一区二| 亚洲在线免费播放| 91精品久久久久久久99蜜桃| 日韩精品一二三| 中文字幕日本不卡| 色婷婷久久久久swag精品| 亚洲一区二区偷拍精品| 欧美老人xxxx18| 久久国产精品免费| 国产欧美精品区一区二区三区| 成人性生交大片| 亚洲精品日日夜夜| 欧美日韩高清在线播放| 激情成人综合网| 国产精品久久午夜| 精品视频999| 国产在线播放一区三区四| 亚洲国产精品t66y| 在线观看国产一区二区| 午夜国产精品影院在线观看| 蜜桃视频免费观看一区| 日韩av午夜在线观看| 色综合天天综合网天天看片| 国产精品久久精品日日| 一本久久精品一区二区| 奇米色777欧美一区二区| 久久综合久久综合久久| 91亚洲精品一区二区乱码| 亚洲综合免费观看高清完整版| 欧美一卡二卡在线| 成人精品一区二区三区四区| 亚洲一级不卡视频| 久久久久久97三级| 在线亚洲一区观看| 久久99精品国产麻豆婷婷洗澡| 国产精品色哟哟| 欧美日韩精品一区二区三区四区| 紧缚奴在线一区二区三区| 亚洲免费在线电影| 精品国产麻豆免费人成网站| av在线不卡观看免费观看| 轻轻草成人在线| 中文字幕+乱码+中文字幕一区| 欧美日韩综合在线免费观看| 国产激情一区二区三区桃花岛亚洲| 亚洲精品老司机| 国产日产精品一区| 在线成人午夜影院| 色偷偷久久人人79超碰人人澡| 激情亚洲综合在线| 亚洲高清久久久| 国产精品视频yy9299一区| 日韩欧美黄色影院| 在线观看国产日韩| 国产欧美日韩三区| 91精品国产色综合久久不卡蜜臀 | 91天堂素人约啪| 国模套图日韩精品一区二区 |