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

📄 applet.java

📁 java 平台 telnet 繁体中文版
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	    System.out.println("Applet: access for '"+	                       privileges.elementAt(i)+"' allowed");	   } catch(Exception e) {	     System.err.println("Applet: access for '"+	                        privileges.elementAt(i)+"' denied");	   }        // set up the clipboard	try {          clipboard = appletFrame.getToolkit().getSystemClipboard();	  System.err.println("Applet: acquired system clipboard: "+clipboard);        } catch(Exception e) {          System.err.println("Applet: system clipboard access denied: "+	    ((e instanceof InvocationTargetException) ? 	      ((InvocationTargetException)e).getTargetException() : e));	  // e.printStackTrace();        } finally {	  if(clipboard == null) {            System.err.println("Applet: copy & paste only within the JTA");            clipboard = new Clipboard("de.mud.jta.Main");	  }        }	  	if((new Boolean(options.getProperty("Applet.detach.immediately"))	     .booleanValue())) {	  if((new Boolean(options.getProperty("Applet.detach.fullscreen"))	     .booleanValue()))	    ((Frame)appletFrame)	      .setSize(appletFrame.getToolkit().getScreenSize());	  else            ((Frame)appletFrame).pack();	  ((Frame)appletFrame).show();	  pluginLoader.broadcast(new ReturnFocusRequest());	  close.setLabel(startText != null ? stopText : "Disconnect");	} else	  close.setLabel(startText != null ? startText : "Connect");	close.addActionListener(new ActionListener() {	  public void actionPerformed(ActionEvent evt) {	    if(((Frame)appletFrame).isVisible()) {	      pluginLoader.broadcast(new SocketRequest());	      ((Frame)appletFrame).setVisible(false);	      close.setLabel(startText != null ? startText : "Connect");	    } else {	      if(frameTitle == null)              ((Frame)appletFrame)	        .setTitle("jta: "+host+(port.equals("23")?"":" "+port));	      if((new Boolean(options.getProperty("Applet.detach.fullscreen"))	         .booleanValue()))	        ((Frame)appletFrame)	          .setSize(appletFrame.getToolkit().getScreenSize());	      else	        ((Frame)appletFrame).pack();              ((Frame)appletFrame).show();              getAppletContext().showStatus("Trying "+host+" "+port+" ...");              pluginLoader.broadcast(new SocketRequest(host, 	                                               Integer.parseInt(port)));              pluginLoader.broadcast(new ReturnFocusRequest());	      close.setLabel(stopText != null ? stopText : "Disconnect");	    }          }	});	 setLayout(new BorderLayout());	 add("Center", close);	// add a menu bar        MenuBar mb = new MenuBar();        Menu file = new Menu("File");        file.setShortcut(new MenuShortcut(KeyEvent.VK_H, true));        MenuItem tmp;        file.add(tmp = new MenuItem("Connect"));        tmp.addActionListener(new ActionListener() {          public void actionPerformed(ActionEvent evt) {            pluginLoader.broadcast(new SocketRequest(host, 	                                             Integer.parseInt(port)));          }        });        file.add(tmp = new MenuItem("Disconnect"));        tmp.addActionListener(new ActionListener() {          public void actionPerformed(ActionEvent evt) {            pluginLoader.broadcast(new SocketRequest());          }        });	file.add(new MenuItem("-"));        file.add(tmp = new MenuItem("Print"));        tmp.addActionListener(new ActionListener() {          public void actionPerformed(ActionEvent evt) {            if(pluginLoader.getComponents().get("Terminal") != null) {              PrintJob printJob =                 appletFrame.getToolkit()                  .getPrintJob((Frame)appletFrame,"JTA Terminal",null);              ((Component)pluginLoader.getComponents().get("Terminal"))                .print(printJob.getGraphics());              printJob.end();            }          }        });        file.add(new MenuItem("-"));        file.add(tmp = new MenuItem("Exit"));        tmp.addActionListener(new ActionListener() {          public void actionPerformed(ActionEvent evt) {            ((Frame)appletFrame).setVisible(false);	    pluginLoader.broadcast(new SocketRequest());	    close.setLabel(startText != null ? startText : "Connect");          }        });	mb.add(file);	Menu edit = new Menu("Edit");        edit.setShortcut(new MenuShortcut(KeyEvent.VK_H, true));        edit.add(tmp = new MenuItem("Copy"));        tmp.addActionListener(new ActionListener() {          public void actionPerformed(ActionEvent evt) {	    if(debug > 2)	      System.err.println("Applet: copy: "+focussedPlugin);            if(focussedPlugin instanceof VisualTransferPlugin)	      ((VisualTransferPlugin)focussedPlugin).copy(clipboard);          }        });        edit.add(tmp = new MenuItem("Paste"));        tmp.addActionListener(new ActionListener() {          public void actionPerformed(ActionEvent evt) {	    if(debug > 2)	      System.err.println("Applet: paste: "+focussedPlugin);            if(focussedPlugin instanceof VisualTransferPlugin)	      ((VisualTransferPlugin)focussedPlugin).paste(clipboard);          }        });        mb.add(edit);	Hashtable menuList = pluginLoader.getMenus();        names = menuList.keys();        while(names.hasMoreElements()) {          String name = (String)names.nextElement();          mb.add((Menu)menuList.get(name));        }	// only add the menubar if the property is true        if((new Boolean(options.getProperty("Applet.detach.menuBar"))           .booleanValue()))          ((Frame)appletFrame).setMenuBar(mb);	// add window closing event handler        try {          ((Frame)appletFrame).addWindowListener(new WindowAdapter() {	    public void windowClosing(WindowEvent evt) {	      pluginLoader.broadcast(new SocketRequest());              ((Frame)appletFrame).setVisible(false);	      close.setLabel(startText != null ? startText : "Connect");	    }	  });	} catch(Exception e) {	  System.err.println("Applet: could not set up Window event listener");	  System.err.println("Applet: you will not be able to close it");	}        pluginLoader.registerPluginListener(new OnlineStatusListener() {          public void online() {	    if(debug > 0) System.err.println("Terminal: online");            online = true;            if(((Frame)appletFrame).isVisible() == false)      	      ((Frame)appletFrame).setVisible(true);	  } 	  public void offline() {	    if(debug > 0) System.err.println("Terminal: offline");            online=false;	    if(disconnectCloseWindow) {	      ((Frame)appletFrame).setVisible(false);	      close.setLabel(startText != null ? startText : "Connect");	    }	  }        });        // register a focus status listener, so we know when a plugin got focus        pluginLoader.registerPluginListener(new FocusStatusListener() {          public void pluginGainedFocus(Plugin plugin) {            if(Applet.debug > 0)	      System.err.println("Applet: "+plugin+" got focus");            focussedPlugin = plugin;          }          public void pluginLostFocus(Plugin plugin) {            // we ignore the lost focus            if(Applet.debug > 0)              System.err.println("Applet: "+plugin+" lost focus");          }        });      } else        // if we have no external frame use this online status listener        pluginLoader.registerPluginListener(new OnlineStatusListener() {          public void online() {            if(debug > 0) System.err.println("Terminal: online");            online = true;          }          public void offline() {            if(debug > 0) System.err.println("Terminal: offline");            online=false;          }        });     }  }  /**   * Start the applet. Connect to the remote host.   */  public void start() {    if(!online && (appletFrame == this || connect)) {      if(debug > 0) System.err.println("start("+host+", "+port+")");      getAppletContext().showStatus("Trying "+host+" "+port+" ...");      pluginLoader.broadcast(new SocketRequest(host, Integer.parseInt(port)));      pluginLoader.broadcast(new ReturnFocusRequest());    }   }  /**   * Stop the applet and disconnect.   */  public void stop() {    if(online && disconnect) {      if(debug > 0) System.err.println("stop()");      pluginLoader.broadcast(new SocketRequest());    }  }  /**   * Override any properties that are found in the configuration files   * with possible values found as applet parameters.   * @param options the loaded configuration file properties   */  private void parameterOverride(Properties options) {    Enumeration e = options.keys();    while(e.hasMoreElements()) {      String key = (String)e.nextElement(), value = getParameter(key);      if(value != null) {	System.out.println("Applet: overriding value of "+key+" with "+value);        // options.setProperty(key, value);        options.put(key, value);      }    }  }}

⌨️ 快捷键说明

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