Last active
March 8, 2018 19:24
-
-
Save hatimmohammed369/4faa6ee2308d2c30c8e66b22b4172bec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.Application; | |
import javafx.stage.Stage; | |
import javafx.scene.Scene; | |
import javafx.scene.layout.*; | |
import javafx.scene.control.*; | |
import javafx.scene.image.*; | |
import javafx.geometry.*; | |
import javafx.scene.paint.Color; | |
import javafx.scene.shape.Circle; | |
import javafx.stage.StageStyle; | |
public class Miniturized extends Application { | |
@Override | |
public void start(Stage stage) { | |
Pane root = new Pane(); | |
Image img = new Image("circle.png"); | |
Circle redCircle = new Circle(9.5, Color.RED); | |
Circle blueCircle = new Circle(9.5, Color.BLUE); | |
root.getChildren().addAll(redCircle, blueCircle, new ImageView(img)); | |
redCircle.relocate((300-img.getWidth())-45, 3); | |
blueCircle.relocate((300-img.getWidth())-20, 3); | |
root.getChildren().get(root.getChildren().size()-1).relocate(300-img.getWidth(), 0); | |
root.getChildren().get(root.getChildren().size()-1).setOnMousePressed((event) -> { | |
if(((Color) redCircle.getFill()) == Color.RED){ | |
redCircle.setFill(Color.BLUE); | |
blueCircle.setFill(Color.RED); | |
}else if(((Color) redCircle.getFill()) == Color.BLUE){ | |
redCircle.setFill(Color.RED); | |
blueCircle.setFill(Color.BLUE); | |
} | |
}); | |
stage.setScene(new Scene(root, 300, 300)); | |
stage.initStyle(StageStyle.UNDECORATED); | |
stage.show(); | |
} | |
public static void main(String[] arguments) { | |
launch(arguments); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment