gaclust.java
来自「clustering data for the different techni」· Java 代码 · 共 1,955 行 · 第 1/5 页
JAVA
1,955 行
NRowsLabel.setPreferredSize(prefDim); NRowsLabel.setHorizontalAlignment(SwingConstants.RIGHT); NRowsLabel.setText("Number of rows:"); NRowsLabelPanel.add(NRowsLabel); DatabaseCenterPanel.add(NRowsLabelPanel); NRowsTextField.setPreferredSize(prefDim); NRowsTextField.setText("101"); NRowsTextField.setToolTipText(Strings.NROWS_TIP); NRowsPanel.add(NRowsTextField); DatabaseCenterPanel.add(NRowsPanel); DatabaseCenterPanel.add(BogusLabel1); NAttrLabel.setPreferredSize(prefDim); NAttrLabel.setHorizontalAlignment(SwingConstants.RIGHT); NAttrLabel.setText("Number of attributes :"); NAttrLabelPanel.add(NAttrLabel); DatabaseCenterPanel.add(NAttrLabelPanel); NAttrTextField.setPreferredSize(prefDim); NAttrTextField.setText("17"); NAttrTextField.setToolTipText(Strings.NATTR_TIP); NAttrPanel.add(NAttrTextField); DatabaseCenterPanel.add(NAttrPanel); DatabaseCenterPanel.add(BogusLabel2); DatabasePanel.add(DatabaseCenterPanel, BorderLayout.CENTER); OpenButton.setText("Open"); OpenButton.addActionListener(this); OpenButton.setMnemonic(KeyEvent.VK_O); OpenButton.setToolTipText(Strings.OPENDB_TIP); DatabaseSouthPanel.add(OpenButton); DatabasePanel.add(DatabaseSouthPanel, BorderLayout.SOUTH); DatabaseSplitPane.setLeftComponent(DatabasePanel); Results.setLayout(new BorderLayout()); // display cardinalities in the database text area by // double-clicking a row DBTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() < 2) return; int rowNo = DBTable.rowAtPoint(event.getPoint()); DBTableModel dbModel = (DBTableModel)DBTable.getModel(); DBLogTextArea.append(dbModel.getValueAt(rowNo, 0) + Strings.endl); DBLogTextArea.append(dbModel.getValueAt(rowNo, 1) + Strings.endl); } }); DBTableScrollPane.setViewportView(DBTable); ResultsNorth.setLayout(new GridLayout(0, 1)); ResultsNorth.setPreferredSize(new Dimension(900, 350)); ResultsNorth.add(DBTableScrollPane); Results.add(ResultsNorth, BorderLayout.NORTH); DBLogTextArea.setLineWrap(true); DBLogTextArea.setText(Strings.DBINTRO); DBLogTextArea.setEditable(false); DatabaseScrollPane.setViewportView(DBLogTextArea); ResultsSouth.setPreferredSize(new Dimension(900, 100)); ResultsSouth.setLayout(new GridLayout(0, 1)); ResultsSouth.add(DatabaseScrollPane); Results.add(ResultsSouth, BorderLayout.SOUTH); DatabaseSplitPane.setRightComponent(Results); MainTabbedPane.addTab("Database", DatabaseSplitPane); MainTabbedPane.setEnabledAt(0, true); //////////// Generate ///////////////////// GenerateSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); GenerateDBPanel.setLayout(new BorderLayout()); GenerateDBPanel.setBorder(new TitledBorder(Strings.GENDBBORDERTITLE)); GenerateDBNorthPanel.setLayout(new GridLayout(6,3)); GenDBNameLabel.setPreferredSize(prefDim); GenDBNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); GenDBNameLabel.setText("Database name :"); GenDBNameLabelPanel.add(GenDBNameLabel); GenerateDBNorthPanel.add(GenDBNameLabelPanel); GenDBNameTextField.setPreferredSize(prefDim); GenDBNameTextField.setToolTipText(Strings.GENDBNAME_TIP); GenDBNamePanel.add(GenDBNameTextField); GenerateDBNorthPanel.add(GenDBNamePanel); UseDefaultNamingCheckBox.setText("Use default naming"); UseDefaultNamingCheckBox.setPreferredSize(prefDim); UseDefaultNamingCheckBox.setToolTipText(Strings.USEDEFNAME_TIP); UseDefaultNamingPanel.add(UseDefaultNamingCheckBox); GenerateDBNorthPanel.add(UseDefaultNamingPanel); GenNRowsLabel.setPreferredSize(prefDim); GenNRowsLabel.setHorizontalAlignment(SwingConstants.RIGHT); GenNRowsLabel.setText("Number of rows:"); GenNRowsLabelPanel.add(GenNRowsLabel); GenerateDBNorthPanel.add(GenNRowsLabelPanel); GenNRowsTextField.setPreferredSize(prefDim); GenNRowsTextField.setToolTipText(Strings.NROWS_TIP); GenNRowsPanel.add(GenNRowsTextField); GenerateDBNorthPanel.add(GenNRowsPanel); GenerateDBNorthPanel.add(GenBogusLabel1); GenNAttrLabel.setPreferredSize(prefDim); GenNAttrLabel.setHorizontalAlignment(SwingConstants.RIGHT); GenNAttrLabel.setText("Number of attributes :"); GenNAttrLabelPanel.add(GenNAttrLabel); GenerateDBNorthPanel.add(GenNAttrLabelPanel); GenNAttrTextField.setPreferredSize(prefDim); GenNAttrTextField.setToolTipText(Strings.NATTR_TIP); GenNAttrPanel.add(GenNAttrTextField); GenerateDBNorthPanel.add(GenNAttrPanel); GenerateDBNorthPanel.add(GenBogusLabel2); GenNClassesLabel.setPreferredSize(prefDim); GenNClassesLabel.setHorizontalAlignment(SwingConstants.RIGHT); GenNClassesLabel.setText("Number of classes :"); GenNClassesLabelPanel.add(GenNClassesLabel); GenerateDBNorthPanel.add(GenNClassesLabelPanel); GenNClassesTextField.setPreferredSize(prefDim); GenNClassesTextField.setToolTipText(Strings.NCLASSES_TIP); GenNClassesPanel.add(GenNClassesTextField); GenerateDBNorthPanel.add(GenNClassesPanel); GenerateDBNorthPanel.add(GenBogusLabel3); GenRandomSeedLabel.setPreferredSize(prefDim); GenRandomSeedLabel.setHorizontalAlignment(SwingConstants.RIGHT); GenRandomSeedLabel.setText("Random generator seed :"); GenRandomSeedLabelPanel.add(GenRandomSeedLabel); GenerateDBNorthPanel.add(GenRandomSeedLabelPanel); GenRandomSeedTextField.setPreferredSize(prefDim); GenRandomSeedTextField.setToolTipText(Strings.RANDSEED_TIP); GenRandomSeedPanel.add(GenRandomSeedTextField); GenerateDBNorthPanel.add(GenRandomSeedPanel); GenerateDBNorthPanel.add(GenBogusLabel4); GenerateLargeCheckBox.setHorizontalAlignment(SwingConstants.RIGHT); GenerateLargeCheckBox.setPreferredSize(prefDim); GenerateLargeCheckBox.setText("Generate one large class"); GenerateLargeCheckBox.setToolTipText(Strings.GENLARGE_TIP); GenerateLargePanel.add(GenerateLargeCheckBox); GenerateDBNorthPanel.add(GenerateLargeCheckBox); GenerateDBNorthPanel.add(GenBogusLabel5); GenerateDBNorthPanel.add(GenBogusLabel6); GenerateDBPanel.add(GenerateDBNorthPanel, BorderLayout.NORTH); GenerateButton.setText("Generate"); GenerateButton.addActionListener(this); GenerateButton.setMnemonic(KeyEvent.VK_G); GenerateButton.setToolTipText(Strings.GEN_TIP); GenerateDBSouthPanel.add(GenerateButton); GenAbortButton.setText("Abort"); GenAbortButton.setEnabled(false); GenAbortButton.addActionListener(this); GenAbortButton.setMnemonic(KeyEvent.VK_A); GenAbortButton.setToolTipText(Strings.GENABORT_TIP); GenerateDBSouthPanel.add(GenAbortButton); GenProgressBar.setStringPainted(true); GenProgressBarPanel.add(GenProgressBar); GenerateDBSouthPanel.add(GenProgressBarPanel); GenerateDBPanel.add(GenerateDBSouthPanel, BorderLayout.SOUTH); GenerateSplitPane.setLeftComponent(GenerateDBPanel); GenResultsPanel.setLayout(new BorderLayout()); // display cardinalities in the generated database text area by // double-clicking a row GenDBTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() < 2) return; int rowNo = GenDBTable.rowAtPoint(event.getPoint()); DBTableModel dbModel = (DBTableModel)GenDBTable.getModel(); GenLogTextArea.append(dbModel.getValueAt(rowNo, 0) + Strings.endl); GenLogTextArea.append(dbModel.getValueAt(rowNo, 1) + Strings.endl); } }); GenDBTableScrollPane.setViewportView(GenDBTable); GenResultsNorthPanel.setLayout(new GridLayout(0, 1)); GenResultsNorthPanel.setPreferredSize(new Dimension(800, 200)); GenResultsNorthPanel.add(GenDBTableScrollPane); GenResultsPanel.add(GenResultsNorthPanel, BorderLayout.NORTH); GenLogTextArea.setLineWrap(true); GenLogTextArea.setText("Generate a synthetic database" + Strings.endl); GenLogTextArea.setEditable(false); GenLogScrollPane.setViewportView(GenLogTextArea); GenResultsSouthPanel.setLayout(new GridLayout(0, 1)); GenResultsSouthPanel.setPreferredSize(new Dimension(900, 150)); GenResultsSouthPanel.add(GenLogScrollPane); GenResultsPanel.add(GenResultsSouthPanel, BorderLayout.SOUTH); GenerateSplitPane.setRightComponent(GenResultsPanel); MainTabbedPane.addTab("Generate", GenerateSplitPane); MainTabbedPane.setEnabledAt(1, true); ////////// GA ///////////////////////////// GAHorizontalSplitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); GASplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); GAPanel.setLayout(new BorderLayout()); GAPanel.setBorder(new TitledBorder(Strings.GABORDERTITLE)); GACenterPanel.setPreferredSize(new Dimension(600, 300)); GACenterPanel.setLayout(new java.awt.GridLayout(10, 4)); PopSizeLabel.setPreferredSize(prefDim); PopSizeLabel.setHorizontalAlignment(SwingConstants.RIGHT); PopSizeLabel.setText("Population size :"); PopSizeLabelPanel.add(PopSizeLabel); GACenterPanel.add(PopSizeLabelPanel); PopSizeTextField.setPreferredSize(prefDim); PopSizeTextField.setText("100"); PopSizeTextField.setToolTipText(Strings.POPSIZE_TIP); PopSizePanel.add(PopSizeTextField); GACenterPanel.add(PopSizePanel); CrossTypeLabel.setPreferredSize(prefDim); CrossTypeLabel.setHorizontalAlignment(SwingConstants.RIGHT); CrossTypeLabel.setText("Crossover type :"); CrossTypeLabelPanel.add(CrossTypeLabel); GACenterPanel.add(CrossTypeLabelPanel); CrossTypeComboBox.setPreferredSize(prefDim); CrossTypeComboBox.addItem(Strings.CROSS_RAND); CrossTypeComboBox.addItem(Strings.CROSS_X_2RAND_CLASS); CrossTypeComboBox.addItem(Strings.CROSS_AM_X_BEST_CLASS); CrossTypeComboBox.addItem(Strings.CROSS_AM_X_BEST_WORST); CrossTypeComboBox.addItem(Strings.CROSS_AM_X_2RAND_CLASS); CrossTypeComboBox.addItemListener(this); CrossTypeComboBox.setToolTipText(Strings.CROSSTYPE_TIP); CrossTypePanel.add(CrossTypeComboBox); GACenterPanel.add(CrossTypePanel); NClassesClustLabel.setPreferredSize(prefDim); NClassesClustLabel.setHorizontalAlignment(SwingConstants.RIGHT); NClassesClustLabel.setText("Number of classes :"); NClassesClustLabelPanel.add(NClassesClustLabel); GACenterPanel.add(NClassesClustLabelPanel); NClassesClustTextField.setPreferredSize(prefDim); NClassesClustTextField.setText("7"); NClassesClustTextField.setToolTipText(Strings.NCLASSES_TIP); NClassesClustPanel.add(NClassesClustTextField); GACenterPanel.add(NClassesClustPanel); DistrTypeLabel.setPreferredSize(prefDim); DistrTypeLabel.setHorizontalAlignment(SwingConstants.RIGHT); DistrTypeLabel.setText("Distribution type :"); DistrTypeLabelPanel.add(DistrTypeLabel); GACenterPanel.add(DistrTypeLabelPanel); DistrTypeComboBox.setPreferredSize(prefDim); DistrTypeComboBox.addItem(Strings.DISTRIB_NONE); DistrTypeComboBox.addItem(Strings.DISTRIB_RAND); DistrTypeComboBox.addItem(Strings.DISTRIB_TO_EVEN); DistrTypeComboBox.setToolTipText(Strings.DISTRTYPE_TIP); DistrTypePanel.add(DistrTypeComboBox); GACenterPanel.add(DistrTypePanel); CrossRateLabel.setPreferredSize(prefDim); CrossRateLabel.setHorizontalAlignment(SwingConstants.RIGHT); CrossRateLabel.setText("Crossover rate :"); CrossRateLabelPanel.add(CrossRateLabel); GACenterPanel.add(CrossRateLabelPanel); CrossRateTextField.setPreferredSize(prefDim); CrossRateTextField.setText("0.8"); CrossRateTextField.setToolTipText(Strings.CROSSRATE_TIP); CrossRatePanel.add(CrossRateTextField); GACenterPanel.add(CrossRatePanel); MutTypeLabel.setPreferredSize(prefDim); MutTypeLabel.setHorizontalAlignment(SwingConstants.RIGHT); MutTypeLabel.setText("Mutation type :"); MutTypeLabelPanel.add(MutTypeLabel); GACenterPanel.add(MutTypeLabelPanel); MutTypeComboBox.setPreferredSize(prefDim); MutTypeComboBox.addItem(Strings.MUT_RAND); MutTypeComboBox.addItem(Strings.MUT_MOVE_ELEM); MutTypeComboBox.addItem(Strings.MUT_SWAP_ELEM); MutTypeComboBox.setToolTipText(Strings.MUTTYPE_TIP); MutTypePanel.add(MutTypeComboBox); GACenterPanel.add(MutTypePanel); MutRateLabel.setPreferredSize(prefDim); MutRateLabel.setHorizontalAlignment(SwingConstants.RIGHT); MutRateLabel.setText("Mutation rate :"); MutRateLabelPanel.add(MutRateLabel); GACenterPanel.add(MutRateLabelPanel); MutRateTextField.setPreferredSize(prefDim); MutRateTextField.setText("0.1"); MutRateTextField.setToolTipText(Strings.MUTRATE_TIP); MutRatePanel.add(MutRateTextField); GACenterPanel.add(MutRatePanel); ClassFitnessLabel.setPreferredSize(prefDim); ClassFitnessLabel.setHorizontalAlignment(SwingConstants.RIGHT); ClassFitnessLabel.setText("Class fitness type :"); ClassFitnessLabelPanel.add(ClassFitnessLabel); GACenterPanel.add(ClassFitnessLabelPanel); ClassFitnessComboBox.setPreferredSize(prefDim); ClassFitnessComboBox.addItem(Strings.CF_SYM_DIFF); ClassFitnessComboBox.addItem(Strings.CF_PROD); ClassFitnessComboBox.addItem(Strings.CF_DIV); ClassFitnessComboBox.addItem(Strings.CF_POW); ClassFitnessComboBox.setToolTipText(Strings.CLASSFITNESSTYPE_TIP); ClassFitnessPanel.add(ClassFitnessComboBox); GACenterPanel.add(ClassFitnessPanel); FitnessThresholdLabel.setPreferredSize(prefDim); FitnessThresholdLabel.setHorizontalAlignment(SwingConstants.RIGHT); FitnessThresholdLabel.setText("Fitness threshold :"); FitnessThresholdLabelPanel.add(FitnessThresholdLabel); GACenterPanel.add(FitnessThresholdLabelPanel); FitnessThresholdTextField.setPreferredSize(prefDim); FitnessThresholdTextField.setText("0.0001"); FitnessThresholdTextField.setToolTipText(Strings.FTHRES_TIP); FitnessThresholdPanel.add(FitnessThresholdTextField); GACenterPanel.add(FitnessThresholdPanel); EntropyMeasureLabel.setPreferredSize(prefDim); EntropyMeasureLabel.setHorizontalAlignment(SwingConstants.RIGHT); EntropyMeasureLabel.setText("Entropy measure :"); EntropyMeasureLabelPanel.add(EntropyMeasureLabel); GACenterPanel.add(EntropyMeasureLabelPanel); EntropyMeasureComboBox.setPreferredSize(prefDim); EntropyMeasureComboBox.addItem(Strings.GINI); EntropyMeasureComboBox.addItem(Strings.ENTROPY); EntropyMeasureComboBox.addItem(Strings.PEAK); //EntropyMeasureComboBox.addItem(Strings.CIRCLE); //EntropyMeasureComboBox.addItem(Strings.SINE); //EntropyMeasureComboBox.addItem(Strings.SQ); EntropyMeasureComboBox.addItem(Strings.GE); EntropyMeasureComboBox.setToolTipText(Strings.ENTROPY_TIP); EntropyMeasurePanel.add(EntropyMeasureComboBox); GACenterPanel.add(EntropyMeasurePanel); ConsecItrsLabel.setPreferredSize(prefDim); ConsecItrsLabel.setHorizontalAlignment(SwingConstants.RIGHT); ConsecItrsLabel.setText("Consecutive iterations :"); ConsecItrsLabelPanel.add(ConsecItrsLabel); GACenterPanel.add(ConsecItrsLabelPanel); ConsecItrsTextField.setPreferredSize(prefDim); ConsecItrsTextField.setText("100"); ConsecItrsTextField.setToolTipText(Strings.CITRS_TIP); ConsecItrsPanel.add(ConsecItrsTextField); GACenterPanel.add(ConsecItrsPanel); FitnessMeasureLabel.setPreferredSize(prefDim); FitnessMeasureLabel.setHorizontalAlignment(SwingConstants.RIGHT); FitnessMeasureLabel.setText("Fitness measure :");
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?