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

📄 ecgplotwindow.java

📁 egc 心电信号检测的源程序
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        mainPanel.setLayout(null);        ecgPlotArea.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED), "Plot Area", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP));        ecgPlotArea.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);        ecgPlotArea.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_NEVER);        mainPanel.add(ecgPlotArea);        ecgPlotArea.setBounds(73, 2, 580, 350);        plotScrollBar.setMaximum(0);        plotScrollBar.setOrientation(javax.swing.JScrollBar.HORIZONTAL);        plotScrollBar.setName("timeScroll");        mainPanel.add(plotScrollBar);        plotScrollBar.setBounds(73, 352, 580, 16);        lblMinAmplitude.setFont(new java.awt.Font("Dialog", 1, 9));        lblMinAmplitude.setText("-0.001");        mainPanel.add(lblMinAmplitude);        lblMinAmplitude.setBounds(30, 309, 40, 12);        lblOrigin.setFont(new java.awt.Font("Dialog", 1, 9));        lblOrigin.setText("0.00");        mainPanel.add(lblOrigin);        lblOrigin.setBounds(30, 167, 40, 12);        lblMaxAmplitude.setFont(new java.awt.Font("Dialog", 1, 9));        lblMaxAmplitude.setText("0.001");        mainPanel.add(lblMaxAmplitude);        lblMaxAmplitude.setBounds(30, 25, 40, 12);        jTextArea1.setBackground(new java.awt.Color(212, 208, 200));        jTextArea1.setLineWrap(true);        jTextArea1.setText("Voltage");        mainPanel.add(jTextArea1);        jTextArea1.setBounds(5, 120, 10, 130);        TableScrollPane.setBorder(new javax.swing.border.TitledBorder(null, "Data Table", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP));        TableScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);        TableScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);        tableValues.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);        TableScrollPane.setViewportView(tableValues);        mainPanel.add(TableScrollPane);        TableScrollPane.setBounds(660, 0, 180, 340);        closeButton.setText("Close");        closeButton.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                closeButtonActionPerformed(evt);            }        });        mainPanel.add(closeButton);        closeButton.setBounds(750, 380, 80, 25);        exportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("img/disk.gif")));        exportButton.setText("Export Data...");        exportButton.setToolTipText("Export Table Data to a File");        exportButton.setIconTextGap(15);        exportButton.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                exportButtonActionPerformed(evt);            }        });        mainPanel.add(exportButton);        exportButton.setBounds(660, 343, 180, 25);        clearButton.setText("Clear");        clearButton.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                clearButtonActionPerformed(evt);            }        });        mainPanel.add(clearButton);        clearButton.setBounds(630, 380, 80, 25);        getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER);        pack();    }//GEN-END:initComponents    private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed        this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));        // Delete the DataTable        clearDataTable();        resetECG();        ecgFrame.repaint();        this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));            }//GEN-LAST:event_clearButtonActionPerformed    private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed        EcgExportWindow exportWin = new EcgExportWindow(null, true, paramOb, calcOb, ecgLog);        exportWin.show();    }//GEN-LAST:event_exportButtonActionPerformed    private void animateStopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_animateStopButtonActionPerformed        /* Stop the Animate Plotting Task */        ecgAnimateTimer.cancel();        ecgAnimateFlg =false;        /* Enable automatic plot */        readyToPlot = true;        /* Repaint Plot Area */        ecgFrame.repaint();        /* Set the Animate Buttons */        stopECGAnimationSetControls();    }//GEN-LAST:event_animateStopButtonActionPerformed    private void animateStartButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_animateStartButtonActionPerformed        // Disabling automatic plot        readyToPlot = false;        ecgFrame.repaint();        /*         * Initialize ECG Animate variables         */        ecgAnimateFlg = true;        ecgAnimateNumRows = tableValuesModel.getRowCount();        ecgAnimateCurRow = 0;        ecgAnimatePanelWidth = ecgFrame.getBounds().width;        ecgAnimateInitialZero = 0;        ecgAnimateLastPoint.setLocation(0, posOriginY - (int)(Double.valueOf(tableValues.getValueAt(0, 1).toString()).doubleValue() * frameAmplitude / paramOb.getAmplitude()));                /* Create Timer */        ecgAnimateTimer = new Timer();        /* Schedule the Animate Plotting Task */        ecgAnimateTimer.scheduleAtFixedRate(new ECGAnimate(), 0, paramOb.getEcgAnimateInterval());                /* Set the Animate Buttons */        startECGAnimationSetControls();    }//GEN-LAST:event_animateStartButtonActionPerformed    private void zoomInButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomInButtonActionPerformed        this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));         plotZoom = plotZoom / plotZoomInc;        ecgFrame.repaint();        this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));    }//GEN-LAST:event_zoomInButtonActionPerformed    private void zoomOutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomOutButtonActionPerformed        this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));        plotZoom = plotZoom * plotZoomInc;        ecgFrame.repaint();        this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));    }//GEN-LAST:event_zoomOutButtonActionPerformed    private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed        //this.setVisible(false);        this.dispose();    }//GEN-LAST:event_closeButtonActionPerformed    private void generateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateButtonActionPerformed        this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));        /*         * Clear Status text.         */        ecgLog.println("************************************************************");        ecgLog.println("ECGSYN:\nA program for generating a realistic synthetic ECG\n");         ecgLog.println("Copyright (c) 2003 by Patrick McSharry & Gari Clifford.");        ecgLog.println("All rights reserved.");        ecgLog.println("See IEEE Transactions On Biomedical Engineering, 50(3),\n289-294, March 2003.\n");        ecgLog.println("Contact:\nP. McSharry (patrick@mcsharry.net)\nG. Clifford (gari@mit.edu)");        ecgLog.println("************************************************************\n");        ecgLog.println("ECG process started.\n");               ecgLog.println("Starting to clear table data and widgets values....");        /*         * Set the Amplitude labels         */        lblMaxAmplitude.setText(Double.toString(paramOb.getAmplitude()));        lblMinAmplitude.setText("-" + Double.toString(paramOb.getAmplitude()));        /*         * Re init the plot state.         * Disable repaint for the moment, until we finish the FFT function.         */        readyToPlot = false;        plotScrollBarValue = 0;        plotScrollBar.setMaximum(0);        /* Delete any data on the Data Table. */        clearDataTable();        ecgLog.println("Finished clearing table data and widgets values.\n");        /*         * Call the ECG funtion to calculate the data into the Data Table.         */        if(calcOb.calculateEcg()){            fillDataTable();            ecgLog.println("Starting to plot ECG table data....");                        /*            * if the # Data Table rows is less than the ecgFrame width, we do not            * need the scrollbar            */            int rows = tableValuesModel.getRowCount();            if(rows > ecgFrame.getBounds().width){                //JOptionPane.showMessageDialog(this, "Entro a: rows > ecgFrame.getBounds().width");                plotScrollBar.setMaximum(rows - ecgFrame.getBounds().width - 1);             }            /*            * Only plot if there's data in the table.            */            if(rows > 0){                //JOptionPane.showMessageDialog(this, "Entro a: rows > 0");                readyToPlot = true;                ecgGenerated = true;                enableButtons();            }else{                ecgLog.println("No data to plot!.");            }            ecgFrame.repaint();            ecgLog.println("Finished plotting ECG table data.\n");        }        ecgLog.println("Finsihed ECG process.");        ecgLog.println("************************************************************");        this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));    }//GEN-LAST:event_generateButtonActionPerformed            // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JScrollPane TableScrollPane;    private javax.swing.JButton animateStartButton;    private javax.swing.JButton animateStopButton;    private javax.swing.JButton clearButton;    private javax.swing.JButton closeButton;    private javax.swing.JScrollPane ecgPlotArea;    private javax.swing.JButton exportButton;    private javax.swing.JButton generateButton;    private javax.swing.JLabel jLabel1;    private javax.swing.JLabel jLabel2;    private javax.swing.JLabel jLabel3;    private javax.swing.JSeparator jSeparator1;    private javax.swing.JSeparator jSeparator2;    private javax.swing.JSeparator jSeparator3;    private javax.swing.JSeparator jSeparator4;    private javax.swing.JTextArea jTextArea1;    private javax.swing.JLabel lblMaxAmplitude;    private javax.swing.JLabel lblMinAmplitude;    private javax.swing.JLabel lblOrigin;    private javax.swing.JPanel mainPanel;    private javax.swing.JScrollBar plotScrollBar;    private javax.swing.JToolBar plotToolBar;    private javax.swing.JTable tableValues;    private javax.swing.JButton zoomInButton;    private javax.swing.JButton zoomOutButton;    // End of variables declaration//GEN-END:variables        private EcgCalc calcOb;    private EcgParam paramOb;    private EcgLogWindow ecgLog;      private javax.swing.table.DefaultTableModel tableValuesModel;    private ecgPanel ecgFrame;    private EcgApplication mainApp;      private void resetECG(){        ecgGenerated = false;        //clearParameters();        resetPlotArea();        resetButtons();    }    private void clearDataTable(){        // Delete the DataTable        tableValuesModel.setRowCount(0);    }

⌨️ 快捷键说明

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