white blood cells
This commit is contained in:
parent
c57fe1d821
commit
98f6c0f768
@ -1,4 +1,4 @@
|
||||
#Tue, 05 Feb 2019 18:09:27 -0600
|
||||
#Thu, 07 Feb 2019 21:38:24 -0600
|
||||
|
||||
|
||||
C\:\\Users\\cd109\\Desktop\\CancerGrowth=
|
||||
C\:\\Users\\cd109\\Desktop\\temp2\\CancerGrowth=
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/classes/cancergrowth/CellPanel$4.class
Normal file
BIN
build/classes/cancergrowth/CellPanel$4.class
Normal file
Binary file not shown.
Binary file not shown.
@ -3,9 +3,9 @@
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/C:/Users/cd109/Desktop/CancerGrowth/src/cancergrowth/Cell.java</file>
|
||||
<file>file:/C:/Users/cd109/Desktop/CancerGrowth/src/cancergrowth/CancerGrowth.java</file>
|
||||
<file>file:/C:/Users/cd109/Desktop/CancerGrowth/src/cancergrowth/CellPanel.java</file>
|
||||
<file>file:/C:/Users/cd109/Desktop/temp2/CancerGrowth/src/cancergrowth/CellPanel.java</file>
|
||||
<file>file:/C:/Users/cd109/Desktop/temp2/CancerGrowth/src/cancergrowth/Cell.java</file>
|
||||
<file>file:/C:/Users/cd109/Desktop/temp2/CancerGrowth/src/cancergrowth/CancerGrowth.java</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
||||
|
@ -104,16 +104,16 @@ public class Cell extends Object
|
||||
Graphics gg0 = g0.getGraphics();
|
||||
if (transparent)
|
||||
{
|
||||
gg0.setColor(new Color(80, 80, 80, 127));
|
||||
gg0.setColor(new Color(165, 0, 255, 127));
|
||||
}
|
||||
else
|
||||
{
|
||||
gm.setColor(new Color(80, 80, 80));
|
||||
gm.setColor(new Color(165, 0, 255));
|
||||
}
|
||||
gg0.fillOval(0, 0, 50, 50);
|
||||
gg0.setColor(Color.BLACK);
|
||||
gg0.drawOval(0, 0, 50, 50);
|
||||
gg0.drawString("G0", 18, 30);
|
||||
gg0.drawString("WBC", 12, 30);
|
||||
p0 = g0;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,9 @@
|
||||
<Component id="speed" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="593" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="513" max="32767" attributes="0"/>
|
||||
<Component id="jButton3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton2" min="-2" pref="63" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
@ -38,6 +40,7 @@
|
||||
<Component id="jButton1" alignment="3" pref="0" max="32767" 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="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="speed" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
@ -89,5 +92,16 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton3">
|
||||
<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="Stable"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -25,6 +25,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
||||
private boolean growing = false;
|
||||
private int count = 0;
|
||||
private boolean kill = false;
|
||||
private boolean dontkill = false;
|
||||
private int pacmanx, pacmany;
|
||||
private int cycle;
|
||||
private boolean cycledir = true;
|
||||
@ -106,7 +107,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
||||
g.fillOval(t.getX(), t.getY(), 50, 50);
|
||||
} else*/
|
||||
//if (cells.size() > 10000000) { // we can simulate until 10000000 first to see what happens isntead of waiting
|
||||
if(kill && (Math.abs(pacmanx + 40 - t.getX()) < 50) && (Math.abs(pacmany + 25 - t.getY()) < 75)) {
|
||||
if(kill && !dontkill && (Math.abs(pacmanx + 40 - t.getX()) < 50) && (Math.abs(pacmany + 25 - t.getY()) < 75)) {
|
||||
cells.remove(t); // If pacman is here, have him eat the cell
|
||||
}
|
||||
else g.drawImage(t.getImage(), t.getX(), t.getY(), this); // otherwise, draw the cell
|
||||
@ -114,7 +115,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
||||
//swingTimer.stop();
|
||||
//}
|
||||
}
|
||||
if(kill) { // draw pacman if he needs to be drawn
|
||||
if(kill && !dontkill) { // draw pacman if he needs to be drawn
|
||||
g.setColor(Color.YELLOW);
|
||||
g.fillArc(pacmanx, pacmany, 100, 100, 220 - cycle * 2, 280 + cycle * 4);
|
||||
if (pacmanx > -100) {
|
||||
@ -155,6 +156,7 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jButton3 = new javax.swing.JButton();
|
||||
|
||||
speed.setMaximum(1000);
|
||||
speed.setMinimum(1);
|
||||
@ -192,6 +194,16 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
||||
}
|
||||
});
|
||||
|
||||
jButton3.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
||||
jButton3.setText("Stable");
|
||||
jButton3.addActionListener(new java.awt.event.ActionListener()
|
||||
{
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
jButton3ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@ -201,7 +213,9 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
||||
.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, 593, Short.MAX_VALUE)
|
||||
.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)
|
||||
@ -215,7 +229,8 @@ public class CellPanel extends javax.swing.JPanel implements ActionListener, Cha
|
||||
.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(jLabel1)
|
||||
.add(jButton2))
|
||||
.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))
|
||||
);
|
||||
@ -236,30 +251,51 @@ 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(kill) { // if we press the kill button, then begin the killing
|
||||
if(dontkill) {
|
||||
dontkill = false;
|
||||
kill = true;
|
||||
swingTimer.setDelay(10);
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream("lib/pacman.mp3");
|
||||
Player player = new Player(fileInputStream); // play pacman sound effect
|
||||
player.play();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace(); // catch any errors with the mp3
|
||||
} catch (JavaLayerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if(kill) { // if we press the kill button, then begin the killing
|
||||
kill = false;
|
||||
swingTimer.setDelay(delay);
|
||||
}
|
||||
else {
|
||||
kill = true;
|
||||
|
||||
swingTimer.setDelay(10);
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream("lib/pacman.mp3");
|
||||
Player player = new Player(fileInputStream); // play pacman sound effect
|
||||
player.play();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace(); // catch any errors with the mp3
|
||||
} catch (JavaLayerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
FileInputStream fileInputStream = new FileInputStream("lib/pacman.mp3");
|
||||
Player player = new Player(fileInputStream); // play pacman sound effect
|
||||
player.play();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace(); // catch any errors with the mp3
|
||||
} catch (JavaLayerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jButton2ActionPerformed
|
||||
|
||||
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;
|
||||
}//GEN-LAST:event_jButton3ActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JButton jButton3;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JSlider speed;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
Loading…
x
Reference in New Issue
Block a user