⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 context.java

📁 一个Web爬虫(机器人
💻 JAVA
字号:
/* * WebSPHINX web crawling toolkit * Copyright (C) 1998,1999 Carnegie Mellon University  *  * This library is free software; you can redistribute it * and/or modify it under the terms of the GNU Library * General Public License as published by the Free Software  * Foundation, version 2. * * WebSPHINX homepage: http://www.cs.cmu.edu/~rcm/websphinx/ */package websphinx.workbench;import java.applet.Applet;import java.applet.AppletContext;public abstract class Context {    static Applet applet;    static String target;    static AppletContext context;    static Browser browser;    static ScriptInterpreter interpreter;    public static boolean isApplet () {        return applet != null;    }    public static boolean isApplication () {        return applet == null;    }    public static void setApplet (Applet _applet) {        applet = _applet;        internalSetApplet ();    }    public static void setApplet (Applet _applet, String _target) {        applet = _applet;        target = _target;        internalSetApplet ();    }    private static void internalSetApplet () {        context = applet.getAppletContext ();        String browserName;        try {            browserName = System.getProperty ("browser");        } catch (Throwable t) {            browserName = null;        }        if (browserName == null) {            // appletviewer            browser = null;            interpreter = null;        }        else if (browserName.startsWith ("Netscape")) {            // Netscape            Netscape ns = target != null ? new Netscape (context, target) : new Netscape(context, target);            browser = ns;            interpreter = ns.getScriptInterpreter ();        }        // NIY: Internet Explorer        else {            // generic browser            browser = target != null ? new Browser (context, target) : new Browser (context);            interpreter = null;        }    }    public static Applet getApplet () {        return applet;    }    public static AppletContext getAppletContext () {        return context;    }    public static Browser getBrowser () {        return browser;    }    public static ScriptInterpreter getScriptInterpreter () {        return interpreter;    }}

⌨️ 快捷键说明

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