public static void main(String[] args) throws ProjectFileParsingException, EquationException { Project testProj = Project.loadProject( new File("examples/Ex5-Networks/Ex5-Networks.neuro.xml"), new ProjectEventListener() { public void tableDataModelUpdated(String tableModelName) {}; public void tabUpdated(String tabName) {}; public void cellMechanismUpdated() {}; }); SynapticProperties sp = new SynapticProperties("Syn1"); sp.setDelayGenerator(new NumberGenerator(33)); WeightGenerator wg = new WeightGenerator("r*r", true); sp.setWeightsGenerator(wg); SynapticPropertiesDialog dlg = new SynapticPropertiesDialog(new Frame(), sp, testProj); // Dimension dlgSize = dlg.getPreferredSize(); dlg.setModal(true); dlg.pack(); dlg.setVisible(true); System.out.println("wg: " + sp.getWeightsGenerator()); }
void jButtonWeights_actionPerformed(ActionEvent e) { NumberGeneratorDialog dlg = new NumberGeneratorDialog( (Frame) null, "Weights", "Weight of synaptic connections", mySynProps.getWeightsGenerator(), true); // Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = dlg.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } dlg.setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); dlg.setVisible(true); jTextFieldWeights.setText(mySynProps.getWeightsGenerator().toShortString()); // mySynProps.setWeightsGenerator(dlg.getFinalNumGen()); }
private void extraInit() { addSynapses(); jTextFieldDelay.setText(mySynProps.getDelayGenerator().toShortString()); jTextFieldWeights.setText(mySynProps.getWeightsGenerator().toShortString()); jTextFieldThreshold.setText(mySynProps.getThreshold() + ""); jComboBoxSynapseType.setSelectedItem(mySynProps.getSynapseType()); }
void jButtonOK_actionPerformed(ActionEvent e) { logger.logComment("OK button pressed"); cancelled = false; double threshold; try { threshold = Double.parseDouble(jTextFieldThreshold.getText()); } catch (NumberFormatException ex) { GuiUtils.showErrorMessage( logger, "Please enter a number (usually -50 -> 0) for the millivolt value of the firing threshold", ex, this); return; } mySynProps.setThreshold(threshold); String selectedSynapse = (String) jComboBoxSynapseType.getSelectedItem(); mySynProps.setSynapseType(selectedSynapse); this.dispose(); }