// Set up the substance selector box private void setUpList() { List s = system.getSubstances(); for (Object o : s) { Substance sub = (Substance) o; substanceBoxModel.addElement(sub.getName()); } }
private void runButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_runButtonActionPerformed Substance[] substances = new Substance[selectedSubstanceNames.getSize()]; for (int i = 0; i < substances.length; i++) substances[i] = (Substance) (system.get((String) (selectedSubstanceNames.get(i)))); rss.start(); } // GEN-LAST:event_runButtonActionPerformed
// Sets the substance field to whatever substance is selected by the combo // box private void setSubstance() { String name = (String) substanceSelector.getSelectedItem(); substance = (Substance) system.getEntity(name); if (metric != null) { metric.setSubstance(substance); } updateTarget(); }
public void setUpList() { List substances = system.getSubstances(); int nSubs = substances.size(); // substances.length; Substance s; for (int i = 0; i < nSubs; i++) { s = (Substance) (substances.get(i)); substanceNames.addElement(s.getName()); } }
// <editor-fold defaultstate="collapsed" // desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { splitPane = new javax.swing.JSplitPane(); jPanel2 = new javax.swing.JPanel(); runButton = new javax.swing.JButton(); stopButton = new javax.swing.JButton(); plotButton = new javax.swing.JButton(); jSplitPane4 = new javax.swing.JSplitPane(); jPanel3 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); systemName = new javax.swing.JLabel(); cyclesField = new javax.swing.JTextField(); timeField = new javax.swing.JTextField(); setLayout(new java.awt.BorderLayout()); splitPane.setDividerSize(5); splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); runButton.setText("Run"); runButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { runButtonActionPerformed(evt); } }); jPanel2.add(runButton); stopButton.setText("Stop"); stopButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stopButtonActionPerformed(evt); } }); jPanel2.add(stopButton); plotButton.setText("Plot"); plotButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { plotButtonActionPerformed(evt); } }); jPanel2.add(plotButton); splitPane.setRightComponent(jPanel2); jSplitPane4.setDividerSize(1); jPanel3.setLayout(new java.awt.GridLayout(3, 1)); jLabel1.setText("System"); jLabel1.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N jPanel3.add(jLabel1); jLabel5.setText("Rounds"); jLabel5.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N jPanel3.add(jLabel5); jLabel7.setText("Time"); jLabel7.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N jPanel3.add(jLabel7); jSplitPane4.setLeftComponent(jPanel3); jPanel4.setLayout(new java.awt.GridLayout(3, 1)); systemName.setText(system.getName()); systemName.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); systemName.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N jPanel4.add(systemName); cyclesField.setHorizontalAlignment(javax.swing.JTextField.TRAILING); cyclesField.setText(String.valueOf(rss.getRounds())); cyclesField.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cyclesFieldActionPerformed(evt); } }); cyclesField.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { cyclesFieldFocusLost(evt); } }); jPanel4.add(cyclesField); timeField.setHorizontalAlignment(javax.swing.JTextField.TRAILING); timeField.setText(String.valueOf(rss.getTime())); timeField.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { timeFieldActionPerformed(evt); } }); timeField.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { timeFieldFocusLost(evt); } }); jPanel4.add(timeField); jSplitPane4.setRightComponent(jPanel4); splitPane.setLeftComponent(jSplitPane4); add(splitPane, java.awt.BorderLayout.CENTER); } // </editor-fold>//GEN-END:initComponents