import javafx.scene.paint.Color; import javafx.scene.canvas.GraphicsContext; public class Foorituli{ Color toon; GraphicsContext gc; int x, y; int seisund; //0-pime 1-põleb 2-vilgub String[] seisundid={"pime", "poleb", "vilgub"}; public Foorituli(Color toon, int x, int y, GraphicsContext gc){ this.toon=toon; this.gc=gc; this.x=x; this.y=y; seisund=0; joonista(); } public void joonista(){ if(seisund==0){gc.setFill(Color.BLACK);} else {gc.setFill(toon);} gc.fillOval(x, y, 30, 30); } public void uusSeisund(int nr){ if(nr==seisund){ System.out.println("Tule "+toon+" seisund endiselt "+seisundid[seisund]); } System.out.println("Tuli "+toon+" oli seisundis "+seisundid[seisund]); seisund=nr; System.out.println("Tuli "+toon+" seisundis "+seisundid[seisund]); joonista(); } }