diff --git a/build/built-jar.properties b/build/built-jar.properties index 4bd3e32..72ac385 100644 --- a/build/built-jar.properties +++ b/build/built-jar.properties @@ -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= diff --git a/build/classes/cancergrowth/Cell.class b/build/classes/cancergrowth/Cell.class index 730b964..aa6a2ac 100644 Binary files a/build/classes/cancergrowth/Cell.class and b/build/classes/cancergrowth/Cell.class differ diff --git a/build/classes/cancergrowth/CellPanel$1.class b/build/classes/cancergrowth/CellPanel$1.class index 5579589..e4b16a8 100644 Binary files a/build/classes/cancergrowth/CellPanel$1.class and b/build/classes/cancergrowth/CellPanel$1.class differ diff --git a/build/classes/cancergrowth/CellPanel$2.class b/build/classes/cancergrowth/CellPanel$2.class index 33503d6..4dd5c55 100644 Binary files a/build/classes/cancergrowth/CellPanel$2.class and b/build/classes/cancergrowth/CellPanel$2.class differ diff --git a/build/classes/cancergrowth/CellPanel$3.class b/build/classes/cancergrowth/CellPanel$3.class index 61d7c8d..8c83dfa 100644 Binary files a/build/classes/cancergrowth/CellPanel$3.class and b/build/classes/cancergrowth/CellPanel$3.class differ diff --git a/build/classes/cancergrowth/CellPanel$4.class b/build/classes/cancergrowth/CellPanel$4.class new file mode 100644 index 0000000..73cb6c0 Binary files /dev/null and b/build/classes/cancergrowth/CellPanel$4.class differ diff --git a/build/classes/cancergrowth/CellPanel.class b/build/classes/cancergrowth/CellPanel.class index 14b6a7b..66ad2e2 100644 Binary files a/build/classes/cancergrowth/CellPanel.class and b/build/classes/cancergrowth/CellPanel.class differ diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index a8e1909..1cacd73 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,9 +3,9 @@ - file:/C:/Users/cd109/Desktop/CancerGrowth/src/cancergrowth/Cell.java - file:/C:/Users/cd109/Desktop/CancerGrowth/src/cancergrowth/CancerGrowth.java - file:/C:/Users/cd109/Desktop/CancerGrowth/src/cancergrowth/CellPanel.java + file:/C:/Users/cd109/Desktop/temp2/CancerGrowth/src/cancergrowth/CellPanel.java + file:/C:/Users/cd109/Desktop/temp2/CancerGrowth/src/cancergrowth/Cell.java + file:/C:/Users/cd109/Desktop/temp2/CancerGrowth/src/cancergrowth/CancerGrowth.java diff --git a/src/cancergrowth/Cell.java b/src/cancergrowth/Cell.java index 0458323..fcde5a9 100644 --- a/src/cancergrowth/Cell.java +++ b/src/cancergrowth/Cell.java @@ -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; } diff --git a/src/cancergrowth/CellPanel.form b/src/cancergrowth/CellPanel.form index 3e509b4..718df4e 100644 --- a/src/cancergrowth/CellPanel.form +++ b/src/cancergrowth/CellPanel.form @@ -21,7 +21,9 @@ - + + + @@ -38,6 +40,7 @@ + @@ -89,5 +92,16 @@ + + + + + + + + + + + diff --git a/src/cancergrowth/CellPanel.java b/src/cancergrowth/CellPanel.java index b63fa55..01aa37e 100644 --- a/src/cancergrowth/CellPanel.java +++ b/src/cancergrowth/CellPanel.java @@ -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