|
|
|
@ -97,7 +97,10 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
{
|
|
|
|
|
super.paintComponent(g);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int g1 = 0;
|
|
|
|
|
int s = 0;
|
|
|
|
|
int g2 = 0;
|
|
|
|
|
int m = 0;
|
|
|
|
|
int x = cells.size() - 1;
|
|
|
|
|
for (int k = x; k >= 0; k--) // Use a loop to draw each cell
|
|
|
|
|
{
|
|
|
|
@ -112,6 +115,18 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
}
|
|
|
|
|
else g.drawImage(t.getImage(), t.getX(), t.getY(), this); // otherwise, draw the cell
|
|
|
|
|
|
|
|
|
|
if(t.currentStage == 0) {
|
|
|
|
|
g1 ++;
|
|
|
|
|
}
|
|
|
|
|
if(t.currentStage == 1) {
|
|
|
|
|
s ++;
|
|
|
|
|
}
|
|
|
|
|
if(t.currentStage == 2) {
|
|
|
|
|
g2 ++;
|
|
|
|
|
}
|
|
|
|
|
if(t.currentStage == 3) {
|
|
|
|
|
m ++;
|
|
|
|
|
}
|
|
|
|
|
//swingTimer.stop();
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
@ -136,6 +151,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
kill = false; // turn off pacman
|
|
|
|
|
}
|
|
|
|
|
jLabel1.setText("Delay: " + delay + "ms. Hours since start: " + count + ". Cell Count: " + cells.size());
|
|
|
|
|
jLabel2.setText("Cyclin G1: " + g1 * 99 + ". Cyclin S: " + s * 99 + ". Cyclin G2: " + g2 * 99 + ". Cyclin M: " + m * 99);
|
|
|
|
|
System.out.println("Cell Count: " + cells.size());
|
|
|
|
|
//growing = false;
|
|
|
|
|
}
|
|
|
|
@ -157,6 +173,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
jButton1 = new javax.swing.JButton();
|
|
|
|
|
jButton2 = new javax.swing.JButton();
|
|
|
|
|
jButton3 = new javax.swing.JButton();
|
|
|
|
|
jLabel2 = new javax.swing.JLabel();
|
|
|
|
|
|
|
|
|
|
speed.setMaximum(1000);
|
|
|
|
|
speed.setMinimum(1);
|
|
|
|
@ -204,21 +221,29 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
jLabel2.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
|
|
|
|
jLabel2.setText("jLabel2");
|
|
|
|
|
|
|
|
|
|
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
|
|
|
|
|
this.setLayout(layout);
|
|
|
|
|
layout.setHorizontalGroup(
|
|
|
|
|
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
|
|
|
|
.add(layout.createSequentialGroup()
|
|
|
|
|
.addContainerGap()
|
|
|
|
|
.add(speed, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
|
|
|
|
.add(jLabel1)
|
|
|
|
|
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 513, Short.MAX_VALUE)
|
|
|
|
|
.add(jButton3)
|
|
|
|
|
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
|
|
|
|
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
|
|
|
|
.add(jButton1)
|
|
|
|
|
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
|
|
|
|
.add(layout.createSequentialGroup()
|
|
|
|
|
.add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 789, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.add(0, 199, Short.MAX_VALUE))
|
|
|
|
|
.add(layout.createSequentialGroup()
|
|
|
|
|
.add(speed, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
|
|
|
|
.add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
.add(18, 18, 18)
|
|
|
|
|
.add(jButton3)
|
|
|
|
|
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
|
|
|
|
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
|
|
|
|
|
.add(jButton1)))
|
|
|
|
|
.add(18, 18, 18))
|
|
|
|
|
);
|
|
|
|
|
layout.setVerticalGroup(
|
|
|
|
@ -227,12 +252,14 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
.addContainerGap()
|
|
|
|
|
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
|
|
|
|
|
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
|
|
|
|
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
|
|
|
|
.add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
.add(jLabel1)
|
|
|
|
|
.add(jButton2)
|
|
|
|
|
.add(jButton3))
|
|
|
|
|
.add(org.jdesktop.layout.GroupLayout.LEADING, speed, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
|
|
|
.addContainerGap(959, Short.MAX_VALUE))
|
|
|
|
|
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 934, Short.MAX_VALUE)
|
|
|
|
|
.add(jLabel2)
|
|
|
|
|
.addContainerGap())
|
|
|
|
|
);
|
|
|
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
|
|
|
|
|
@ -247,6 +274,8 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
{//GEN-HEADEREND:event_jButton1ActionPerformed
|
|
|
|
|
swingTimer.setDelay(delay); // When we press start, start the simulation
|
|
|
|
|
swingTimer.start();
|
|
|
|
|
kill = false;
|
|
|
|
|
dontkill = false;
|
|
|
|
|
}//GEN-LAST:event_jButton1ActionPerformed
|
|
|
|
|
|
|
|
|
|
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton2ActionPerformed
|
|
|
|
@ -289,6 +318,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
// TODO add your handling code here:
|
|
|
|
|
kill = true;
|
|
|
|
|
dontkill = true;
|
|
|
|
|
swingTimer.setDelay(100);
|
|
|
|
|
}//GEN-LAST:event_jButton3ActionPerformed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -297,6 +327,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
|
|
|
|
private javax.swing.JButton jButton2;
|
|
|
|
|
private javax.swing.JButton jButton3;
|
|
|
|
|
private javax.swing.JLabel jLabel1;
|
|
|
|
|
private javax.swing.JLabel jLabel2;
|
|
|
|
|
private javax.swing.JSlider speed;
|
|
|
|
|
// End of variables declaration//GEN-END:variables
|
|
|
|
|
|
|
|
|
|