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; public double radius; public Circle circle; public MuehleButton(int ring,int relX, int relY, double absX, double absY, Color color, Game game) { 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); } public Shape getShape() { return circle; } 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