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

📄 bigmsgdisplay.java

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Copyright (c) 2003, Vanderbilt University * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice, the following * two paragraphs and the author appear in all copies of this software. *  * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *  * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. *//** * @author Andras Nadas, Miklos Maroti * @last modified 12/04/2003 */package net.tinyos.mcenter;import net.tinyos.packet.*;import java.util.*;public class BigMSGDisplay extends MessageCenterInternalFrame implements PacketListenerIF{        protected byte activeMessage = 0x5F;    protected boolean supressId = false;    protected java.text.SimpleDateFormat timestamp = null;        protected java.io.File saveFile = new java.io.File("standard.out");    protected java.io.FileOutputStream fileOut;    protected java.io.PrintWriter out;        private BigMSGDisplay instance = null;        private java.util.prefs.Preferences prefsRoot = java.util.prefs.Preferences.userNodeForPackage(this.getClass());    private java.util.prefs.Preferences prefs;    /** Creates new form BigMSGDisplay */    public BigMSGDisplay() {        super("Big Message Display");        instance = this;        prefs = prefsRoot.node(prefsRoot.absolutePath()+"/BigMSGDisplay");        activeMessage = (byte)prefs.getInt("ActiveMessage",0x5f);        initComponents();        SerialConnector.instance().registerPacketListener(this,activeMessage);        this.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter(){            public void internalFrameClosing(javax.swing.event.InternalFrameEvent e){                SerialConnector.instance().removePacketListener(instance,activeMessage);                //CenterFrame.instance().removeChildFrame(instance);            }        });    }            /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */    private void initComponents() {//GEN-BEGIN:initComponents        java.awt.GridBagConstraints gridBagConstraints;        jScrollPane1 = new javax.swing.JScrollPane();        jTextArea1 = new javax.swing.JTextArea();        subPanel = new javax.swing.JPanel();        stateLabel = new javax.swing.JLabel();        stateTextField = new javax.swing.JTextField();        jSeparator1 = new javax.swing.JSeparator();        timestampCheckBox = new javax.swing.JCheckBox();        noidCheckBox = new javax.swing.JCheckBox();        typeLabel = new javax.swing.JLabel();        typeTextField = new javax.swing.JTextField();        jSeparator2 = new javax.swing.JSeparator();        saveCheckBox = new javax.swing.JCheckBox();        jTextField1 = new javax.swing.JTextField();        jButton1 = new javax.swing.JButton();        setTitle("Big Message Display");        jScrollPane1.setPreferredSize(new java.awt.Dimension(320, 240));        jScrollPane1.setViewportView(jTextArea1);        getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);        subPanel.setLayout(new java.awt.GridBagLayout());        stateLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);        stateLabel.setText("state");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        subPanel.add(stateLabel, gridBagConstraints);        stateTextField.setEditable(false);        stateTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);        stateTextField.setText("mote:0/0");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        subPanel.add(stateTextField, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        subPanel.add(jSeparator1, gridBagConstraints);        timestampCheckBox.setText("print timestamp");        timestampCheckBox.addItemListener(new java.awt.event.ItemListener() {            public void itemStateChanged(java.awt.event.ItemEvent evt) {                timestampCheckBoxItemStateChanged(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.weightx = 1.0;        subPanel.add(timestampCheckBox, gridBagConstraints);        noidCheckBox.setText("noid");        noidCheckBox.addItemListener(new java.awt.event.ItemListener() {            public void itemStateChanged(java.awt.event.ItemEvent evt) {                noidCheckBoxItemStateChanged(evt);            }        });        subPanel.add(noidCheckBox, new java.awt.GridBagConstraints());        typeLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);        typeLabel.setText("msg type");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.weightx = 1.0;        subPanel.add(typeLabel, gridBagConstraints);        typeTextField.setHorizontalAlignment(javax.swing.JTextField.TRAILING);        typeTextField.setText("0x"+Integer.toString((byte)activeMessage & 0xFF,16).toUpperCase());        typeTextField.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                typeTextFieldActionPerformed(evt);            }        });        typeTextField.addFocusListener(new java.awt.event.FocusAdapter() {            public void focusLost(java.awt.event.FocusEvent evt) {                typeTextFieldFocusLost(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.weightx = 2.0;        subPanel.add(typeTextField, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.weightx = 1.0;        subPanel.add(jSeparator2, gridBagConstraints);        saveCheckBox.setText("save");        saveCheckBox.addItemListener(new java.awt.event.ItemListener() {            public void itemStateChanged(java.awt.event.ItemEvent evt) {                saveCheckBoxItemStateChanged(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.weightx = 4.0;        subPanel.add(saveCheckBox, gridBagConstraints);        jTextField1.setEditable(false);        jTextField1.setText("standard.out");        jTextField1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jTextField1ActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridwidth = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.weightx = 3.0;        subPanel.add(jTextField1, gridBagConstraints);        jButton1.setText("..");        jButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton1ActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;

⌨️ 快捷键说明

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