Created
December 29, 2015 23:12
-
-
Save abd3lraouf/f6c530e65b13d7e849c8 to your computer and use it in GitHub Desktop.
Always rectangle
This file contains hidden or 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
package Junit; | |
import javafx.application.*; | |
import javafx.scene.*; | |
import javafx.scene.layout.*; | |
import javafx.scene.paint.*; | |
import javafx.scene.shape.*; | |
import javafx.stage.*; | |
public class AlwaysRectangle extends Application { | |
public static void main(String[] args) { | |
launch(args); | |
} | |
@Override | |
public void start(Stage primaryStage) throws Exception { | |
Rectangle rectangle = new Rectangle(500, 250); | |
rectangle.setFill(Color.TRANSPARENT); | |
rectangle.setStroke(Color.BLACK); | |
rectangle.widthProperty().bind(primaryStage.widthProperty().subtract(100)); | |
rectangle.heightProperty().bind(rectangle.widthProperty().divide(2)); | |
StackPane stackPane = new StackPane(); | |
stackPane.getChildren().addAll(rectangle); | |
Scene scene = new Scene(stackPane); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment