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

📄 remoteprintwindow.java

📁 无线传感器网络节点Sun SPOT管理工具
💻 JAVA
字号:
/* * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.  *  * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is * described in this document. In particular, and without limitation, these intellectual property rights may * include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents * or pending patent applications in the U.S. and in other countries. *  * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. * standard license agreement and applicable provisions of the FAR and its supplements. *  * Use is subject to license terms.  *  * This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo and * Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  *  * Copyright (c) 2006 Sun Microsystems, Inc. Tous droits r?serv?s. *  * Sun Microsystems, Inc. d?tient les droits de propri?t? intellectuels relatifs ? la technologie incorpor?e dans * le produit qui est d?crit dans ce document. En particulier, et ce sans limitation, ces droits de propri?t? * intellectuelle peuvent inclure un ou plus des brevets am?ricains list?s ? l'adresse http://www.sun.com/patents * et un ou les brevets suppl?mentaires ou les applications de brevet en attente aux Etats - Unis et dans les * autres pays. *  * L'utilisation est soumise aux termes du contrat de licence. *  * Cette distribution peut comprendre des composants d?velopp?s par des tierces parties. * Sun, Sun Microsystems, le logo Sun et Java sont des marques de fabrique ou des marques d?pos?es de Sun * Microsystems, Inc. aux Etats-Unis et dans d'autres pays. */package com.sun.spot.spotworld.gui;import com.sun.spot.spotworld.participants.Application;import com.sun.spot.spotworld.participants.SunSPOT;import java.io.PrintStream;import javax.swing.JFrame;import org.sunspotworld.remoteprinting.RemotePrintHandler;/** * * @author randy */public class RemotePrintWindow {        /* fields we may not need **/    private Application app;    private PrintStream printStream;    private JFrame window;        /* fileds we think we need */    private IUIObject  uiObject;                    //Object to relate to on the screen.    private String     isoalteID;                   //isoalte unique id, or "currentIsolate"    private int        portNumber;            private SunSPOT    host;    private RemotePrintHandler remotePrintHandler;     public void open(IUIObject iuio, String isoID, String appName, int portToUse, SunSPOT hostObject){        setHost(hostObject);        portNumber = portToUse;        final SPOTTextExternalWindow frame = initAndMakeExternalFrame( iuio,  isoID,  appName, portToUse,  hostObject);        javax.swing.SwingUtilities.invokeLater(                new Runnable() {            public void run() {                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);                //Display the window.                frame.pack();                frame.setVisible(true);            }        }        );        String addr = getHost().getAddress();        setRemotePrintHandler(new RemotePrintHandler(addr, portNumber, getPrintStream()));        getHost().addRemotePrintHandler(getRemotePrintHandler());        getRemotePrintHandler().start();    }           public SPOTTextExternalWindow initAndMakeExternalFrame(IUIObject uiuo, final String isoID, String appName, int portToUse, SunSPOT hostObject){        String hostName = getHost().getName();        SPOTTextExternalWindow frame = new SPOTTextExternalWindow(){            public void dispose() {                super.dispose();                getHost().stopRemotePrintingApp(isoID, getPortNumber());                getHost().removeRemotePrintHandler(getRemotePrintHandler());                (RemotePrintWindow.this).closeStreams();            }        };        frame.setTitle("Sytem.out from " + appName + " on " + hostName);        setPrintStream(frame.makePrintStream());        return frame;    }        public void closeStreams(){        getPrintStream().close();        getRemotePrintHandler().quit();     }    public int getPortNumber() {        return portNumber;    }    public IUIObject getUiObject() {        return uiObject;    }    public void setUiObject(IUIObject uiObject) {        this.uiObject = uiObject;    }    public String getIsoalteID() {        return isoalteID;    }    public void setIsoalteID(String isoalteID) {        this.isoalteID = isoalteID;    }    public void setPortNumber(int portNumber) {        this.portNumber = portNumber;    }    public SunSPOT getHost() {        return host;    }    public void setHost(SunSPOT host) {        this.host = host;    }    public RemotePrintHandler getRemotePrintHandler() {        return remotePrintHandler;    }    public void setRemotePrintHandler(RemotePrintHandler remotePrintHandler) {        this.remotePrintHandler = remotePrintHandler;    }    public PrintStream getPrintStream() {        return printStream;    }    public void setPrintStream(PrintStream printStream) {        this.printStream = printStream;    }    }

⌨️ 快捷键说明

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