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

📄 console.java

📁 这是一个以JAVA编写的程序,本人还没有试过,是一个简单的温度控制系统
💻 JAVA
字号:
package net.sf.dz.view.tcp.client;import java.io.FileNotFoundException;import java.net.URL;import java.awt.Dimension;import java.awt.GridLayout;import javax.swing.JFrame;import javax.swing.WindowConstants;import org.freehold.jukebox.conf.Configuration;import org.freehold.jukebox.conf.ConfigurationFactory;import org.freehold.jukebox.logger.LogChannel;import org.freehold.jukebox.service.ActiveService;public class Console extends ActiveService {    public static final LogChannel CH_CONSOLE = new LogChannel("Console");    /**     * The keyword to use look up the configuration URL from the     * environment.     */    public static final String ENV_CF_URL = "dz.console.conf.URL";        /**     * Master configuration.     */    private Configuration conf;        private JFrame mainFrame;    private ClientPanel display;    protected void startup() throws Throwable {            String confURL = System.getProperty(ENV_CF_URL);        String remoteHost = "localhost";        int remotePort = 5014;        boolean secure = false;        String password = null;                if ( confURL == null ) {                    throw new IllegalArgumentException("Please define " + ENV_CF_URL + " environment property");        }                try {                    conf = (new ConfigurationFactory()).getConfiguration(new URL(confURL));            complain(LOG_INFO, CH_CONSOLE, "Configuring from " + confURL);                        remoteHost = conf.getString("console.tcp.host", "localhost");            remotePort = conf.getInteger("console.tcp.port", 5014);            secure = conf.getBoolean("console.tcp.secure");            password = conf.getString("console.tcp.password");                    } catch ( FileNotFoundException fnfex ) {                    complain(LOG_ERR, CH_CONSOLE, "Can't load the master configuration from " + confURL + ", cause:", fnfex);            complain(LOG_WARNING, CH_CONSOLE, "Trying default: localhost:5014, insecure.");        }        mainFrame = new JFrame("DIY Zoning Console");        mainFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);                // VT: FIXME: Read the configuration or the command line                display = new ClientPanel(getLogger(), remoteHost, remotePort, secure, password);                mainFrame.getContentPane().setLayout(new GridLayout(1, 1));        mainFrame.getContentPane().add(display);        mainFrame.pack();        mainFrame.setVisible(true);    }        protected void execute() throws Throwable {            display.getSemDown().waitFor();    }    protected void shutdown(Throwable cause) throws Throwable {            mainFrame.dispose();    }}

⌨️ 快捷键说明

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