📄 statisticalresultspanel.java
字号:
/* * $RCSfile: StatisticalResultsPanel.java,v $ * $Revision: 1.2 $ * $Date: 2005/04/25 01:26:31 $ * * NeuralNetworkToolkit * Copyright (C) 2004 Universidade de Brasília * * This file is part of NeuralNetworkToolkit. * * NeuralNetworkToolkit is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * NeuralNetworkToolkit 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. * * You should have received a copy of the GNU General Public License * along with NeuralNetworkToolkit; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 - USA. */package neuralnetworktoolkit.gui.inference;import java.awt.BorderLayout;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.util.ResourceBundle;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.border.TitledBorder;import neuralnetworktoolkit.StatisticalResults;/** * Training statistical results panel. * * @version $Revision: 1.2 $ - $Date: 2005/04/25 01:26:31 $ * * @author <a href="mailto:rodbra@pop.com.br">Rodrigo C. M. Coimbra</a> * @author <a href="mailto:hugoiver@yahoo.com.br">Hugo Iver V. Gonçalves</a> */public class StatisticalResultsPanel extends JPanel { private JLabel numberOfIterationsLabel; private JTextField numberOfIterationsField; private JPanel numberOfIterationsPanel; private JLabel numberOfEpochsLabel; private JTextField numberOfEpochsField; private JPanel numberOfEpochsPanel; private JLabel trainingTimeLabel; private JTextField trainingTimeField; private JPanel trainingTimePanel; private JLabel errorLabel; private JTextField errorField; private JPanel errorPanel; private JPanel resultsPanel; private Insets borderInsets; private ResourceBundle resource; public StatisticalResultsPanel(StatisticalResults results) { super(); long iterations = 0; long epochs = 0; resource = ResourceBundle .getBundle("neuralnetworktoolkit.gui.inference.resources.StatisticalResultsPanelResource"); borderInsets = new Insets(5, 5, 5, 5); numberOfIterationsLabel = new JLabel(resource.getString("numberOfIterations")); numberOfIterationsField = new JTextField(); iterations = results.getNumberIterations(); if(iterations > 0) { numberOfIterationsField.setText(Long.toString(iterations)); } else { numberOfIterationsField.setText(""); } numberOfIterationsField.setEditable(false); numberOfIterationsPanel = new JPanel(); numberOfIterationsPanel.setLayout(new BorderLayout()); numberOfIterationsPanel.add(numberOfIterationsLabel, BorderLayout.NORTH); numberOfIterationsPanel.add(numberOfIterationsField, BorderLayout.CENTER); numberOfEpochsLabel = new JLabel(resource.getString("numberOfEpochs")); numberOfEpochsField = new JTextField(); epochs = results.getNumberOfEpochs(); if(epochs > 0) { numberOfEpochsField.setText(Long.toString(epochs)); } else { numberOfEpochsField.setText(""); } numberOfEpochsField.setEditable(false); numberOfEpochsPanel = new JPanel(); numberOfEpochsPanel.setLayout(new BorderLayout()); numberOfEpochsPanel.add(numberOfEpochsLabel, BorderLayout.NORTH); numberOfEpochsPanel.add(numberOfEpochsField, BorderLayout.CENTER); trainingTimeLabel = new JLabel(resource.getString("trainingTime")); trainingTimeField = new JTextField(); trainingTimeField.setText(Double.toString(results.getTrainingTime())); trainingTimeField.setEditable(false); trainingTimePanel = new JPanel(); trainingTimePanel.setLayout(new BorderLayout()); trainingTimePanel.add(trainingTimeLabel, BorderLayout.NORTH); trainingTimePanel.add(trainingTimeField, BorderLayout.CENTER); errorLabel = new JLabel(resource.getString("error")); errorField = new JTextField(); errorField.setText(Double.toString(results.getError())); errorField.setEditable(false); errorPanel = new JPanel(); errorPanel.setLayout(new BorderLayout()); errorPanel.add(errorLabel, BorderLayout.NORTH); errorPanel.add(errorField, BorderLayout.CENTER); resultsPanel = new JPanel(); resultsPanel.setLayout(new GridBagLayout()); resultsPanel.add(numberOfIterationsPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, borderInsets, 67, 0)); resultsPanel.add(numberOfEpochsPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, borderInsets, 67, 0)); resultsPanel.add(trainingTimePanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, borderInsets, 67, 0)); resultsPanel.add(errorPanel, new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, borderInsets, 67, 0)); resultsPanel.setBorder(new TitledBorder("")); this.setLayout(new GridBagLayout()); this.add(resultsPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, borderInsets, 67, 0)); } //StatisticalResultsPanel()} //StatisticalResultsPanel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -