13.10 end
This commit is contained in:
@@ -14,16 +14,18 @@ public class MuehleButton {
|
||||
public double absoluteX;
|
||||
public double absoluteY;
|
||||
|
||||
public Color color;
|
||||
public Color color = Color.BLUE;
|
||||
|
||||
public double radius;
|
||||
|
||||
public Circle circle;
|
||||
|
||||
public int ring;
|
||||
public int id;
|
||||
|
||||
public MuehleButton(int ring,int relX, int relY, double absX, double absY, Color color, Game game) {
|
||||
this.ring = ring;
|
||||
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;
|
||||
@@ -39,17 +41,30 @@ public class MuehleButton {
|
||||
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<MouseEvent> mouse_click_target = new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent event) {
|
||||
System.out.println("Button Clicked!");
|
||||
if (isActive) {
|
||||
MouseClick();
|
||||
} // end of if
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user