import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape.Shape; import javafx.event.Event; import javafx.event.EventHandler; import javafx.scene.input.MouseEvent; public class MuehleButton { public Game game; public int relativeX; public int relativeY; public double absoluteX; public double absoluteY; public Color color = Color.BLUE; public double radius; public Circle circle; public int id; public boolean isActive = true; public MuehleButton(int id,int relX, int relY, double absX, double absY, Game game) { this.id = id; relativeX = relX; relativeY = relY; absoluteX = absX; absoluteY = absY; radius = 20; this.color = color; circle = new Circle(absoluteX, absoluteY, radius); circle.setFill(this.color); this.game = game; circle.addEventHandler(MouseEvent.MOUSE_RELEASED, mouse_click_target); setActive(true); } public Shape getShape() { return circle; } public void setActive(boolean value) { isActive = value; if(value == true) { circle.setFill(this.color); } else { //circle.setFill(Color.rgb(0,0,0,0)); circle.setFill(Color.rgb(0,255,0)); } } EventHandler mouse_click_target = new EventHandler() { public void handle(MouseEvent event) { System.out.println("Button Clicked!"); MouseClick(); } }; public void MouseClick() { game.chip_button_clicked(this); } } // end of MuehleButton