📄 rtmonitor.java
字号:
/** LiMon-JClient * Copyright (C) 2006 Marcelo Busico * * Author: Marcelo Busico marcelobusico@gmail.com * * This program is free software which I release under the GNU General Public * License. You may redistribute and/or modify this program under the terms * of that license as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. Version 2 is in the * LICENSE.txt file in the top level directory of this distribution. * * To get a copy of the GNU General Puplic License, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package Ventanas;import limonclient.*;import java.io.*;import javax.swing.*;import java.awt.*;import java.awt.event.*;public class RTMonitor extends javax.swing.JFrame { private Conexion conexion; private Principal principal; private Timer timer; private UpTime ut; private Microprocesador micro; private MemoriaFisica mem; private MemoriaIntercambio swap; private Temperatura temp; private HoraSistema hora; private FechaSistema fecha; private Servidores serv; private EstadoDisco disc; private int cuenta5; private int cuenta3; /** Creates new form RTMonitor */ public RTMonitor() { initComponents(); } /** Creates new form RTMonitor */ public RTMonitor(Conexion cn, Principal princ) { conexion=cn; principal=princ; timer = new Timer(1000, new TimerListener()); ut=new UpTime(); micro=new Microprocesador(); mem= new MemoriaFisica(); swap = new MemoriaIntercambio(); temp = new Temperatura(); hora = new HoraSistema(); fecha = new FechaSistema(); serv = new Servidores(); disc = new EstadoDisco(); cuenta5=5; cuenta3=3; initComponents(); recuperarDatos(); timer.start(); btnDesconectar.grabFocus(); barMicro.setMaximum(100); barMicro.setMinimum(0); } /** 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. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { btnDesconectar = new javax.swing.JButton(); btnSalir = new javax.swing.JButton(); fraMicro = new javax.swing.JPanel(); barMicro = new javax.swing.JProgressBar(); lblMicro = new javax.swing.JLabel(); fraMemoriaFisica = new javax.swing.JPanel(); lblMemoriaUsada = new javax.swing.JLabel(); lblMemoriaLibre = new javax.swing.JLabel(); lblMemoriaBuffer = new javax.swing.JLabel(); fraIntercambio = new javax.swing.JPanel(); lblIntercambioUsado = new javax.swing.JLabel(); lblIntercambioLibre = new javax.swing.JLabel(); fraTiempo = new javax.swing.JPanel(); lblTiempoServicio = new javax.swing.JLabel(); fraServidor = new javax.swing.JPanel(); lblEstadoWeb = new javax.swing.JLabel(); lblEstadoCorreo = new javax.swing.JLabel(); lblEstadoSSH = new javax.swing.JLabel(); lblEstadoFTP = new javax.swing.JLabel(); lblEstadoSamba = new javax.swing.JLabel(); fraTemp = new javax.swing.JPanel(); lblTempCPU = new javax.swing.JLabel(); lblTempSistema = new javax.swing.JLabel(); lblTempHD = new javax.swing.JLabel(); fraActualizacion = new javax.swing.JPanel(); txtTiempo = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); btnEstablecerTiempo = new javax.swing.JButton(); fraDisco = new javax.swing.JPanel(); lblDiscoRaiz = new javax.swing.JLabel(); lblDiscoHome = new javax.swing.JLabel(); lblFecha = new javax.swing.JLabel(); lblHora = new javax.swing.JLabel(); lblServidor = new javax.swing.JLabel(); lblPuerto = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("LiMon - Monitor en Tiempo Real"); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.event.WindowEvent evt) { formWindowActivated(evt); } public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } public void windowDeactivated(java.awt.event.WindowEvent evt) { formWindowDeactivated(evt); } }); btnDesconectar.setText("Desconectar"); btnDesconectar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnDesconectarActionPerformed(evt); } }); btnSalir.setText("Salir"); btnSalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSalirActionPerformed(evt); } }); fraMicro.setBorder(javax.swing.BorderFactory.createTitledBorder("Microprocesador")); barMicro.setValue(50); lblMicro.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblMicro.setText("X% Usado por el Sistema, Y% Usado por el Usuario"); org.jdesktop.layout.GroupLayout fraMicroLayout = new org.jdesktop.layout.GroupLayout(fraMicro); fraMicro.setLayout(fraMicroLayout); fraMicroLayout.setHorizontalGroup( fraMicroLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, fraMicroLayout.createSequentialGroup() .addContainerGap() .add(fraMicroLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, lblMicro, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.LEADING, barMicro, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE)) .addContainerGap()) ); fraMicroLayout.setVerticalGroup( fraMicroLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(fraMicroLayout.createSequentialGroup() .add(barMicro, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(lblMicro)) ); fraMemoriaFisica.setBorder(javax.swing.BorderFactory.createTitledBorder("Memoria F\u00edsica")); lblMemoriaUsada.setText("x MB Usados"); lblMemoriaLibre.setText("y MB Libres"); lblMemoriaBuffer.setText("z MB en Buffer"); org.jdesktop.layout.GroupLayout fraMemoriaFisicaLayout = new org.jdesktop.layout.GroupLayout(fraMemoriaFisica); fraMemoriaFisica.setLayout(fraMemoriaFisicaLayout); fraMemoriaFisicaLayout.setHorizontalGroup( fraMemoriaFisicaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(fraMemoriaFisicaLayout.createSequentialGroup() .add(44, 44, 44) .add(fraMemoriaFisicaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(lblMemoriaBuffer, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 177, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(fraMemoriaFisicaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(lblMemoriaLibre, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 177, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, lblMemoriaUsada, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 177, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); fraMemoriaFisicaLayout.setVerticalGroup( fraMemoriaFisicaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(fraMemoriaFisicaLayout.createSequentialGroup() .add(lblMemoriaUsada) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(lblMemoriaLibre) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(lblMemoriaBuffer) .add(12, 12, 12)) ); fraIntercambio.setBorder(javax.swing.BorderFactory.createTitledBorder("Memoria de Intercambio")); lblIntercambioUsado.setText("x MB Usados"); lblIntercambioLibre.setText("y MB Libres"); org.jdesktop.layout.GroupLayout fraIntercambioLayout = new org.jdesktop.layout.GroupLayout(fraIntercambio); fraIntercambio.setLayout(fraIntercambioLayout); fraIntercambioLayout.setHorizontalGroup( fraIntercambioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(fraIntercambioLayout.createSequentialGroup() .add(48, 48, 48) .add(fraIntercambioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, lblIntercambioLibre, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE) .add(fraIntercambioLayout.createSequentialGroup() .add(lblIntercambioUsado, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 149, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(24, Short.MAX_VALUE)))) ); fraIntercambioLayout.setVerticalGroup( fraIntercambioLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(fraIntercambioLayout.createSequentialGroup() .add(lblIntercambioUsado) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(lblIntercambioLibre) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -