add some more comments

master
shark 5 years ago
parent 73b1ce4ada
commit 48c79978f3

@ -46,7 +46,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
//cells.add(t1);
Cell t2 = new Cell(475, 475); // Create the initial cell (would be inserted into blood stream)
//choice1.addItem(t2);
cells.add(t2); // add our cell to the ArrayList of cells
cells.add(t2); // add our cell to the ArrayList of cells
//choice2.addItem(t2);
//choice1.setRenderer(new ComboBoxRenderer());
@ -121,8 +121,8 @@ 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 == 0) { // record which phase the cell is in to calculate cyclin levels
g1 ++;
}
if(t.currentStage == 1) {
s ++;
@ -136,7 +136,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
//swingTimer.stop();
//}
}
if(kill && !dontkill) { // draw pacman if he needs to be drawn
if(kill && !dontkill) { // draw pacman if he needs to eat
g.setColor(Color.YELLOW);
g.fillArc(pacmanx, pacmany, 100, 100, 220 - cycle * 2, 280 + cycle * 4);
if (pacmanx > -100) {
@ -156,10 +156,14 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
}
kill = false; // turn off pacman
}
g1 *= 99;
s *= 99;
g2 *= 99;
m *= 99;
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);
// Calculate and print cyclin levels:
jLabel2.setText("Cyclin G1: " + g1 + ". Cyclin S: " + s + ". Cyclin G2: " + g2 + ". Cyclin M: " + m + ".");
System.out.println("Cell Count: " + cells.size());
//growing = false;
}
@ -167,7 +171,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
/** This method is called from within the constructor to initialize the form.
*
* WARNING: Do NOT modify this code by hand. The content of this method is
* always regenerated by the Form Editor. Ignore this part! this just creates the buttons and slider
* always regenerated by the Form Editor. Ignore this part! this just creates the buttons and slider, keep scrolling
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@ -286,7 +290,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton2ActionPerformed
{//GEN-HEADEREND:event_jButton2ActionPerformed
if(dontkill) {
if(dontkill) { // if we are currently in "stable" mode, then kill them
dontkill = false;
kill = true;
swingTimer.setDelay(10);
@ -300,7 +304,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
e.printStackTrace();
}
}
else if(kill) { // if we press the kill button, then begin the killing
else if(kill) { // if we press the kill button while growing normally, then begin the killing
kill = false;
swingTimer.setDelay(delay);
}
@ -321,9 +325,9 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton3ActionPerformed
{//GEN-HEADEREND:event_jButton3ActionPerformed
// TODO add your handling code here:
kill = true;
dontkill = true;
// enter stable mode
kill = true; // bad variable names, we're not actually killing them
dontkill = true; // remind the program NOT to kill them even though kill == true
swingTimer.setDelay(100);
}//GEN-LAST:event_jButton3ActionPerformed

Loading…
Cancel
Save