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()); }
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()); }
private void extraInit() { addSynapses(); jTextFieldDelay.setText(mySynProps.getDelayGenerator().toShortString()); jTextFieldWeights.setText(mySynProps.getWeightsGenerator().toShortString()); jTextFieldThreshold.setText(mySynProps.getThreshold() + ""); jComboBoxSynapseType.setSelectedItem(mySynProps.getSynapseType()); }