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

📄 guiantminerjframe.java

📁 Short description: GUI Ant-Miner is a tool for extracting classification rules from data. It is an u
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
package guiAntMiner;import java.awt.BorderLayout;import java.awt.Canvas;import java.awt.Cursor;import java.awt.Event;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyEvent;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.io.File;import java.text.DecimalFormat;import javax.swing.BorderFactory;import javax.swing.BoxLayout;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JDialog;import javax.swing.JFileChooser;import javax.swing.JLabel;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing.JMenuItem;import javax.swing.JPanel;import javax.swing.JProgressBar;import javax.swing.JScrollPane;import javax.swing.JSeparator;import javax.swing.JTabbedPane;import javax.swing.JTable;import javax.swing.JTextArea;import javax.swing.JTextField;import javax.swing.KeyStroke;import javax.swing.ListSelectionModel;import javax.swing.SwingConstants;import javax.swing.WindowConstants;import javax.swing.border.BevelBorder;import javax.swing.event.ListSelectionEvent;import javax.swing.event.ListSelectionListener;import javax.swing.table.DefaultTableModel;import javax.swing.table.TableModel;/** * Copyright (C) 2007  Fernando Meyer *  * This program 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. *  * 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. *  * A full copy of the license is available in gpl.txt and online at * http://www.gnu.org/licenses/gpl.txt *//*** This code was generated using CloudGarden's Jigloo* SWT/Swing GUI Builder, which is free for non-commercial* use. If Jigloo is being used commercially (ie, by a corporation,* company or business for any purpose whatever) then you* should purchase a license for each developer using Jigloo.* Please visit www.cloudgarden.com for details.* Use of Jigloo implies acceptance of these licensing terms.* ************************************** A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED* for this machine, so Jigloo or this code cannot be used legally* for any corporate or commercial purpose.* **************************************/public class GUIAntMinerJFrame extends javax.swing.JFrame {	/**	 * 	 */	private static final long serialVersionUID = 1L;	{		//Set Look & Feel		try {			javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");		} catch(Exception e) {}	}	private JMenuBar jMenuBar1;	private JMenu jMenu1;	private JMenuItem jMenuItem1;	private JLabel jLabelNumberOfInstances;	private JTable jTable1;	private JTable jTable2;	private TableModel jTable1Model;	private TableModel jTable2Model;	private JLabel jLabel8;	private JLabel jLabel4;	private JLabel jLabel14;	private JLabel jLabel12;	private JLabel jLabel6;	private JTextField jTextField5;	private JTextField jTextField4;	private JTextField jTextField3;	private JTextField jTextField2;	private JPanel jPanel9;	private JTextField jTextField1;	private JLabel jLabel13;	private JPanel jPanel7;	private JButton jButton1;	private JLabel jLabelDistinct;	private JLabel jLabel11;	private JPanel jPanel4;	private JLabel jLabel7;	private JLabel jLabel10;	private JLabel jLabel9;	private JScrollPane jScrollPane3;	private JPanel jPanel6;	private JPanel jPanel5;	private JPanel jPanel3;	private JTabbedPane jTabbedPane1;	private JScrollPane jScrollPane1;	private JLabel jLabelNumberOfAttributes;	private JLabel jLabel5;	private JLabel jLabel3;	private JLabel jLabel2;	private JLabel jLabel1;	private JPanel jPanel1;	private JPanel jPanel2;	private JMenuItem jMenuItem3;	private JMenu jMenu2;	private JMenuItem jMenuItem2;	private JSeparator jSeparator1;	private MyFileReader myFileReader;	private Canvas canvas1;	private JTextField jTextField6;	private JLabel jLabel17;	private JButton jButton2;	private JProgressBar jProgressBar1;	private JPanel jPanel8;	private JCheckBox jCheckBox3;	private JCheckBox jCheckBox2;	private JLabel jLabel15;	private JCheckBox jCheckBox1;	private JTextArea jTextArea1;	private JScrollPane jScrollPane2;	private boolean isClassifying;	private CrossValidation cv;	private Attribute [] attributesArray;	private DataInstance [] dataInstancesArray;	/**	* Auto-generated main method to display this JFrame	*/	public static void main(String[] args) {		GUIAntMinerJFrame inst = new GUIAntMinerJFrame();				inst.setVisible(true);			}		public GUIAntMinerJFrame() {				super();		try{			javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");			javax.swing.SwingUtilities.updateComponentTreeUI(this);		}catch(Exception e){}		initGUI();	}		private void initGUI() {		try {			{				jMenuBar1 = new JMenuBar();				setJMenuBar(jMenuBar1);				jMenuBar1.setPreferredSize(new java.awt.Dimension(392, 26));				{					jMenu1 = new JMenu();					jMenuBar1.add(jMenu1);					jMenu1.setText("File");					jMenu1.setDisplayedMnemonicIndex(0);					jMenu1.setMnemonic(java.awt.event.KeyEvent.VK_F);					{					jMenuItem1 = new JMenuItem();						jMenu1.add(jMenuItem1);						jMenuItem1.setText("Open...");						jMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,Event.CTRL_MASK));						jMenuItem1.setDisplayedMnemonicIndex(0);						jMenuItem1.setMnemonic(java.awt.event.KeyEvent.VK_O);						jMenuItem1.addActionListener(new ActionListener() {							public void actionPerformed(ActionEvent evt) {								final JFileChooser fc = new JFileChooser();								fc.setCurrentDirectory(new File(System.getProperty("user.dir")));																fc.addChoosableFileFilter(new ArffFilter());								int returnVal = fc.showOpenDialog(GUIAntMinerJFrame.this);								if(returnVal == 0){									myFileReader = new MyFileReader(fc.getSelectedFile());									if(myFileReader.fileIsOk()){										attributesArray = myFileReader.getAttributesArray();										dataInstancesArray = myFileReader.getDataInstancesArray();										setLabel2(myFileReader.getRelation());										jLabelNumberOfAttributes.setText(String.valueOf(myFileReader.getAttributesNo()));										jLabelNumberOfInstances.setText(String.valueOf(myFileReader.getInstancesNo()));										setTableAtt1(myFileReader.getAttributesArray());										jTabbedPane1.setEnabledAt(1,true);									}								}							}						});					}					{						jSeparator1 = new JSeparator();						jMenu1.add(jSeparator1);					}					{						jMenuItem2 = new JMenuItem();						jMenu1.add(jMenuItem2);						jMenuItem2.setText("Exit");						jMenuItem2.setDisplayedMnemonicIndex(1);						jMenuItem2.setMnemonic(java.awt.event.KeyEvent.VK_X);						jMenuItem2.addActionListener(new ActionListener() {							public void actionPerformed(ActionEvent evt) {								System.exit(0);							}						});					}				}				{					jMenu2 = new JMenu();					jMenuBar1.add(jMenu2);					jMenu2.setText("Help");					jMenu2.setDisplayedMnemonicIndex(0);					jMenu2.setMnemonic(java.awt.event.KeyEvent.VK_H);					{						jMenuItem3 = new JMenuItem();						jMenu2.add(jMenuItem3);						jMenuItem3.setText("About GUI Ant-Miner");						jMenuItem3.setDisplayedMnemonicIndex(0);						jMenuItem3.setMnemonic(java.awt.event.KeyEvent.VK_A);						jMenuItem3.addActionListener(new ActionListener() {							public void actionPerformed(ActionEvent evt) {								JDialog dialog = new JDialog(GUIAntMinerJFrame.this, true);								AboutGUIAntMinerJDialog inst = new AboutGUIAntMinerJDialog(dialog, GUIAntMinerJFrame.this);								inst.setVisible(true);							}						});					}				}			}			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);			BorderLayout thisLayout = new BorderLayout();			this.getContentPane().setLayout(thisLayout);			this.setTitle("GUI Ant-Miner");			{				jTabbedPane1 = new JTabbedPane();				this.getContentPane().add(jTabbedPane1, BorderLayout.CENTER);				jTabbedPane1.setPreferredSize(new java.awt.Dimension(792, 542));				{					jPanel2 = new JPanel();					GridBagLayout jPanel2Layout = new GridBagLayout();					jPanel2Layout.columnWeights = new double[] {1.0,1.0};					jPanel2Layout.columnWidths = new int[] {400,420};					jPanel2Layout.rowWeights = new double[] {1.0};					jPanel2Layout.rowHeights = new int[] {};					jTabbedPane1.addTab("Preprocess", null, jPanel2, null);					//jPanel2.setLayout(jPanel2Layout);					jPanel2.setPreferredSize(new java.awt.Dimension(787, 514));					jPanel2.setLayout(jPanel2Layout);					jPanel2.setMinimumSize(new java.awt.Dimension(400, 400));					{						jScrollPane1 = new JScrollPane();						jPanel2.add(jScrollPane1, new GridBagConstraints(							0,							0,							1,							1,							1.0,							0.0,							GridBagConstraints.NORTH,							GridBagConstraints.HORIZONTAL,							new Insets(72, 5, 5, 2),							0,							0));						jScrollPane1.setBounds(7, 80, 385, 200);						jScrollPane1.setBorder(BorderFactory.createTitledBorder("Attributes"));						jScrollPane1.setSize(364, 200);						jScrollPane1.setMinimumSize(new java.awt.Dimension(23, 240));						jScrollPane1.setPreferredSize(new java.awt.Dimension(385, 250));					}					{						jPanel1 = new JPanel();						jPanel2.add(jPanel1, new GridBagConstraints(							0,							0,							1,							1,							1.0,							0.0,							GridBagConstraints.NORTH,							GridBagConstraints.HORIZONTAL,							new Insets(5, 5, 5, 2),							0,							0));						GridBagLayout jPanel1Layout = new GridBagLayout();						jPanel1Layout.columnWeights = new double[] { 0.1, 0.1,								0.1, 0.1, 0.1, 0.1 };						jPanel1Layout.columnWidths = new int[] {30,66,120,63,100,20};						jPanel1Layout.rowHeights = new int[] {18,18};						jPanel1Layout.rowWeights = new double[] {0.1,0.1};						jPanel1.setLayout(jPanel1Layout);						jPanel1.setBounds(7, 8, 385, 72);						jPanel1.setBorder(BorderFactory.createTitledBorder("Relation"));						jPanel1.setSize(320, 59);						{							jLabel1 = new JLabel();							jPanel1.add(jLabel1, new GridBagConstraints(								1,								0,								1,								1,								0.0,								0.0,								GridBagConstraints.WEST,								GridBagConstraints.NONE,								new Insets(0, 0, 0, 0),								0,								0));							jLabel1.setText("Relation: ");							jLabel1								.setHorizontalTextPosition(SwingConstants.RIGHT);							jLabel1								.setHorizontalAlignment(SwingConstants.RIGHT);							jLabel1.setFont(new java.awt.Font("Dialog", 0, 12));						}						{							jLabel2 = new JLabel();							jPanel1.add(jLabel2, new GridBagConstraints(								2,								0,								1,								1,								0.0,								0.0,								GridBagConstraints.WEST,								GridBagConstraints.NONE,								new Insets(0, 0, 0, 0),								0,								0));							jLabel2.setFont(new java.awt.Font("Dialog", 0, 12));							jLabel2.setName("                   ");							jLabel2.setText("                ");						}						{							jLabel3 = new JLabel();							jPanel1.add(jLabel3, new GridBagConstraints(								1,								1,								1,								1,								0.0,								0.0,								GridBagConstraints.WEST,								GridBagConstraints.NONE,								new Insets(0, 0, 0, 0),								0,								0));							jLabel3.setText("Instances: ");							jLabel3.setLayout(null);							jLabel3.setFont(new java.awt.Font("Dialog", 0, 12));						}						{							jLabelNumberOfInstances = new JLabel();							jPanel1.add(								jLabelNumberOfInstances,								new GridBagConstraints(									2,									1,									1,									1,									0.0,									0.0,									GridBagConstraints.WEST,									GridBagConstraints.NONE,									new Insets(0, 0, 0, 0),									0,									0));							jLabelNumberOfInstances.setFont(new java.awt.Font("Dialog", 0, 12));							jLabelNumberOfInstances.setText(" ");						}						{							jLabel5 = new JLabel();							jPanel1.add(jLabel5, new GridBagConstraints(								3,								1,								1,								1,								0.0,								0.0,								GridBagConstraints.WEST,								GridBagConstraints.NONE,								new Insets(0, 0, 0, 0),								0,								0));							jLabel5.setText("Attributes: ");							jLabel5.setBounds(0, 0, 41, 16);							jLabel5.setFont(new java.awt.Font("Dialog", 0, 12));						}						{							jLabelNumberOfAttributes = new JLabel();							jPanel1.add(								jLabelNumberOfAttributes,								new GridBagConstraints(									4,									1,									1,									1,									0.0,									0.0,									GridBagConstraints.WEST,									GridBagConstraints.NONE,									new Insets(0, 0, 0, 0),									0,									0));							jLabelNumberOfAttributes.setBounds(0, 0, 41, 16);							jLabelNumberOfAttributes.setFont(new java.awt.Font("Dialog", 0, 12));

⌨️ 快捷键说明

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