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

📄 generaloptionspanel.java

📁 利用Java实现的神经网络工具箱
💻 JAVA
字号:
/* * $RCSfile: GeneralOptionsPanel.java,v $ * $Revision: 1.7 $ * $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.newnetwork;import java.awt.*;import java.util.ResourceBundle;import javax.swing.*;import javax.swing.border.*;/** *  *  * @version $Revision: 1.7 $ - $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 GeneralOptionsPanel extends JPanel {	private BorderLayout mainLayout;	private JPanel panelOptions;	private JPanel usePanel;	private JPanel architecturePanel;	private JPanel methodPanel;	private JPanel networkNamePanel;	private JComboBox architectureCombo;	private JComboBox methodCombo;	private JLabel architectureLabel;	private JLabel useLabel;	private JLabel methodLabel;	private JLabel networkNameLabel;	private JRadioButton regressionRadio;	private JRadioButton classificationRadio;	private ButtonGroup useGroup;	private JTextField networkNameField;		private Insets borderInsets;		private String[] architectures = {"MLP"};	private String[] architecturesNames;	private String[] methods = {"gradientbased.backpropagation.BackPropagation",			"gradientbased.quasinewton.gaussnewton.GaussNewton", 			"gradientbased.quasinewton.lm.LevenbergMarquardt",			"gradientbased.quasinewton.lm.LMAM",			"gradientbased.quasinewton.lm.OLMAM"};	private String[] methodsNames;		private ResourceBundle resource;		/**	 * 	 *  	 */	public GeneralOptionsPanel() {		resource = ResourceBundle				.getBundle("neuralnetworktoolkit.gui.newnetwork.resources.GeneralOptionsPanelResource");				architecturesNames = new String[architectures.length];		architecturesNames[0] = resource.getString("mlp");				methodsNames = new String[methods.length];		methodsNames[0] = resource.getString("backPropagation");		methodsNames[1] = resource.getString("gaussNewton");		methodsNames[2] = resource.getString("levenbergMarquardt");		methodsNames[3] = resource.getString("LMAM");		methodsNames[4] = resource.getString("OLMAM");				panelOptions = new JPanel();		panelOptions.setLayout(new GridBagLayout());		mainLayout = new BorderLayout();		this.setLayout(mainLayout);		mainLayout.setHgap(3);		mainLayout.setVgap(0);		this.add(panelOptions, BorderLayout.CENTER);				borderInsets = new Insets(5, 5, 5, 5);				networkNameLabel = new JLabel(resource.getString("networkName"));		networkNameField = new JTextField(resource.getString("defaultName"));		networkNamePanel = new JPanel();		networkNamePanel.setLayout(new BorderLayout());		networkNamePanel.add(networkNameLabel, BorderLayout.NORTH);		networkNamePanel.add(networkNameField, BorderLayout.SOUTH);		networkNamePanel.setBorder(new EmptyBorder(borderInsets));		architectureLabel = new JLabel(resource.getString("architecture"));		architectureLabel.setVerticalAlignment(SwingConstants.BOTTOM);		architectureCombo = new JComboBox(architecturesNames);		architecturePanel = new JPanel();		architecturePanel.setLayout(new BorderLayout());		architecturePanel.add(architectureCombo, BorderLayout.CENTER);		architecturePanel.add(architectureLabel, BorderLayout.NORTH);		architecturePanel.setBorder(new EmptyBorder(borderInsets));				methodLabel = new JLabel(resource.getString("method"));		methodPanel = new JPanel();		methodPanel.setLayout(new BorderLayout());		methodPanel.add(methodLabel, BorderLayout.NORTH);		methodCombo = new JComboBox(methodsNames);		methodCombo.setSelectedIndex(2);		methodPanel.add(methodCombo, BorderLayout.CENTER);		methodPanel.setBorder(new EmptyBorder(borderInsets));		regressionRadio = new JRadioButton(resource.getString("regression"));		classificationRadio = new JRadioButton(resource.getString("classification"));		classificationRadio.setEnabled(false);		useGroup = new ButtonGroup();		useGroup.add(classificationRadio);		useGroup.add(regressionRadio);		useGroup.setSelected(regressionRadio.getModel(), true);		useLabel = new JLabel(resource.getString("use"));		usePanel = new JPanel();		usePanel.setLayout(new BorderLayout());		usePanel.add(useLabel, BorderLayout.NORTH);		usePanel.add(classificationRadio, BorderLayout.CENTER);		usePanel.add(regressionRadio, BorderLayout.SOUTH);		usePanel.setBorder(new EmptyBorder(borderInsets));		panelOptions.add(			networkNamePanel,			new GridBagConstraints(				0,				0,				1,				1,				1.0,				1.0,				GridBagConstraints.CENTER,				GridBagConstraints.HORIZONTAL,				new Insets(0, 0, 0, 0),				67,				0));				panelOptions.add(			architecturePanel,			new GridBagConstraints(				0,				1,				1,				1,				1.0,				1.0,				GridBagConstraints.CENTER,				GridBagConstraints.HORIZONTAL,				new Insets(0, 0, 0, 0),				67,				0));		panelOptions.add(			methodPanel,			new GridBagConstraints(				0,				2,				1,				1,				1.0,				1.0,				GridBagConstraints.CENTER,				GridBagConstraints.HORIZONTAL,				new Insets(0, 0, 0, 0),				83,				0));		panelOptions.add(			usePanel,			new GridBagConstraints(				0,				3,				1,				1,				1.0,				1.0,				GridBagConstraints.CENTER,				GridBagConstraints.HORIZONTAL,				new Insets(0, 0, 0, 0),				42,				0));		methodCombo.setSelectedIndex(0);		architectureCombo.setSelectedIndex(0);					} //RapidOptionsPanel()		/**	 * 	 * @return	 */	public String getNetworkName() {		return networkNameField.getText();			} //getNetworkName()		/**	 * 	 * @return	 */	public String getMethod() {		return methods[methodCombo.getSelectedIndex()];			} //getMethod()		/**	 * 	 * @return	 */	public String getMethodName() {		return methodsNames[methodCombo.getSelectedIndex()];			} //getMethodName()		/**	 * 	 * @return	 */	public String getArchitecture() {		return architectures[architectureCombo.getSelectedIndex()];			} //getArchitecture()		/**	 * 	 * @return	 */	public int getNetworkUse() {		if(useGroup.isSelected(classificationRadio.getModel()))			return 0;		else return 1;			} //getNetworkUse()	} //RapidOptionsPanel

⌨️ 快捷键说明

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