X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d-demos.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fexamples%2Flife%2FCell.java;h=9b148667af7ef16813dfbbd7927107cf43d9b619;hp=4d1cca0d372b0c74a279137c3be97fb55b1abec1;hb=8d125af6606c9a8432feabc7393e522ab5d29cfe;hpb=151ac55eaaa0f3a2d7a589a0a3ff877b6db09a6f diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java index 4d1cca0..9b14866 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java @@ -9,13 +9,13 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCom /** * This class corresponds to a single cell within matrix. */ -public class Cell extends AbstractCompositeShape implements +class Cell extends AbstractCompositeShape implements MouseInteractionController { /** * cell visual size */ - public static final int SIZE = 20; + static final int SIZE = 20; /** * Color of the active cell (R, G, B, A) */ @@ -27,11 +27,11 @@ public class Cell extends AbstractCompositeShape implements /** * Color of the inactive cell (R, G, B, A) */ - private static final Color INACTIVE_COLOR = new Color("55F5"); + private static final Color INACTIVE_COLOR = new Color("55F8"); /** * Color of the inactive cell (R, G, B, A) while mouse is over it. */ - private static final Color INACTIVE_COLOR_MOUSE_OVER = new Color("77F7"); + private static final Color INACTIVE_COLOR_MOUSE_OVER = new Color("77F8"); /** * A placeholder variable to help in next generation computation. Indicates * whether cell is going to survive within next generation. @@ -98,18 +98,21 @@ public class Cell extends AbstractCompositeShape implements } @Override - public void mouseClicked() { + public boolean mouseClicked() { setActive(!isActive()); + return true; } @Override - public void mouseEntered() { + public boolean mouseEntered() { setMouseOver(true); + return true; } @Override - public void mouseExited() { + public boolean mouseExited() { setMouseOver(false); + return true; } private void setMouseOver(final boolean isMouseOver) {