add cyclin measurements

master
ThirstyShark 6 years ago
parent 98f6c0f768
commit bbb3ae4870

@ -1,4 +1,4 @@
#Thu, 07 Feb 2019 21:38:24 -0600 #Fri, 08 Feb 2019 09:19:53 -0600
C\:\\Users\\cd109\\Desktop\\temp2\\CancerGrowth= C\:\\Users\\cd109\\Desktop\\temp2\\CancerGrowth=

@ -21,7 +21,7 @@ public class Cell extends Object
private int xval; // Declare variables like position, cycle timing private int xval; // Declare variables like position, cycle timing
private int yval; private int yval;
private ArrayList<Integer> stages = new ArrayList<Integer>(); private ArrayList<Integer> stages = new ArrayList<Integer>();
private int currentStage; int currentStage;
private int currentTime; private int currentTime;
private static final BufferedImage p0; private static final BufferedImage p0;
private static BufferedImage[] p1 = new BufferedImage[12]; // Create cell images before the widnow opens private static BufferedImage[] p1 = new BufferedImage[12]; // Create cell images before the widnow opens

@ -18,15 +18,23 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel2" min="-2" pref="789" max="-2" attributes="0"/>
<EmptySpace min="0" pref="199" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="speed" min="-2" max="-2" attributes="0"/> <Component id="speed" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" max="32767" attributes="0"/>
<EmptySpace pref="513" max="32767" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton3" min="-2" max="-2" attributes="0"/> <Component id="jButton3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jButton2" min="-2" pref="63" max="-2" attributes="0"/> <Component id="jButton2" min="-2" pref="63" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/> <Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -37,14 +45,16 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0"> <Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="103" alignment="0" groupAlignment="3" attributes="0"> <Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="jButton1" alignment="3" pref="0" max="32767" attributes="0"/> <Component id="jButton1" alignment="3" max="32767" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Component id="speed" alignment="0" max="32767" attributes="0"/> <Component id="speed" alignment="0" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace pref="959" max="32767" attributes="0"/> <EmptySpace pref="934" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -103,5 +113,13 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="jLabel2"/>
</Properties>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

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

Loading…
Cancel
Save