List of usage examples for javafx.scene.shape Rectangle setStroke
public final void setStroke(Paint value)
From source file:Main.java
@Override public void start(Stage stage) { Rectangle rect1 = new Rectangle(100, 50, Color.LIGHTGRAY); rect1.setStroke(Color.BLACK); Rectangle rect2 = new Rectangle(100, 50, Color.YELLOW); rect2.setStroke(Color.BLACK); Translate translate = new Translate(50, 10); Rotate rotate = new Rotate(30, 0, 0); Scale scale = new Scale(0.5, 0.5); Shear shear = new Shear(0.5, 0.5); rect2.getTransforms().addAll(translate, rotate, scale, shear); Pane root = new Pane(rect1, rect2); root.setPrefSize(200, 100);/*from ww w . jav a2 s . co m*/ Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle(""); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group group = new Group(); Rectangle rect = new Rectangle(20, 20, 200, 200); rect.setStrokeWidth(2);//from ww w.ja v a 2 s . c o m rect.setStroke(Color.RED); group.getChildren().add(rect); Scene scene = new Scene(group, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group group = new Group(); Rectangle rect = new Rectangle(20, 20, 200, 200); rect.setStrokeWidth(2);//from ww w . j a v a 2s . c o m rect.setStroke(Color.RED); rect.setStrokeWidth(1.5); rect.getStrokeDashArray().addAll(3.0, 7.0, 3.0, 7.0); group.getChildren().add(rect); Scene scene = new Scene(group, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group group = new Group(); Rectangle rect = new Rectangle(20, 20, 200, 200); rect.setArcHeight(15);/*from w ww . j a va 2 s . com*/ rect.setArcWidth(15); rect.setStroke(Color.BLACK); group.getChildren().add(rect); Scene scene = new Scene(group, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Button btn = new Button("A big button"); Rectangle rect = new Rectangle(100, 50); rect.setFill(Color.WHITE);//from w w w . j av a 2s. c om rect.setStrokeWidth(1); rect.setStroke(Color.BLACK); HBox root = new HBox(); root.setSpacing(20); root.getChildren().addAll(btn, rect); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Resizable Nodes"); stage.show(); System.out.println("btn.isResizable(): " + btn.isResizable()); System.out.println("rect.isResizable(): " + rect.isResizable()); }
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 500, 260); Rectangle roundRect = new Rectangle(50, 50, 400, 130); roundRect.setArcWidth(30);//from w ww . ja v a2 s .c o m roundRect.setArcHeight(60); roundRect.setFill(null); roundRect.setStroke(Color.DARKORANGE); roundRect.setStrokeWidth(2); roundRect.setStrokeLineCap(StrokeLineCap.BUTT); root.getChildren().add(roundRect); Slider slider = new Slider(30, 150, 30); slider.setLayoutX(250 - slider.getWidth() / 2); slider.setLayoutY(115 - slider.getHeight() / 2); slider.widthProperty().addListener((ov, curVal, newVal) -> { slider.setLayoutX(250 - slider.getWidth() / 2); }); slider.heightProperty() .addListener((ov, curVal, newVal) -> slider.setLayoutY(115 - slider.getHeight() / 2)); roundRect.arcWidthProperty().bind(slider.valueProperty()); root.getChildren().add(slider); Slider slider2 = new Slider(10, 120, 50); slider2.setLayoutX(50); slider2.setLayoutY(230); slider2.widthProperty().addListener((ov, curVal, newVal) -> { slider2.setLayoutX(250 - slider2.getWidth() / 2); }); roundRect.yProperty().bind(slider2.valueProperty()); root.getChildren().add(slider2); slider2.valueProperty().addListener((ov, curVal, newVal) -> slider .setLayoutY(slider.getLayoutY() + newVal.doubleValue() - curVal.doubleValue())); primaryStage.setScene(scene); primaryStage.show(); }
From source file:User.java
private Rectangle drawRectangleBackground() { Rectangle background = new Rectangle(320, 112); background.setX(0);//ww w . ja va 2s .c o m background.setY(0); background.setArcHeight(15); background.setArcWidth(15); background.setFill(Color.rgb(0, 0, 0, 0.55)); background.setStrokeWidth(1.5); background.setStroke(foregroundColor); return background; }
From source file:Main.java
private void addStackPane(HBox hb) { StackPane stack = new StackPane(); Rectangle helpIcon = new Rectangle(30.0, 25.0); helpIcon.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.web("#4977A3")), new Stop(0.5, Color.web("#B0C6DA")), new Stop(1, Color.web("#9CB6CF")), })); helpIcon.setStroke(Color.web("#D0E6FA")); helpIcon.setArcHeight(3.5);//from ww w .j a v a 2 s. c om helpIcon.setArcWidth(3.5); Text helpText = new Text("?"); helpText.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); helpText.setFill(Color.WHITE); helpText.setStroke(Color.web("#7080A0")); stack.getChildren().addAll(helpIcon, helpText); stack.setAlignment(Pos.CENTER_RIGHT); // Add offset to right for question mark to compensate for RIGHT // alignment of all nodes StackPane.setMargin(helpText, new Insets(0, 10, 0, 0)); hb.getChildren().add(stack); HBox.setHgrow(stack, Priority.ALWAYS); }
From source file:Main.java
private TitledPane getShowBoundsControls() { ChangeListener<Boolean> cl = new ChangeListener<Boolean>() { @Override/*from w w w .j av a2 s . co m*/ public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue, Boolean newValue) { relayout(); } }; ChangeListener<Boolean> cl2 = new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observableValue, Boolean oldValue, Boolean newValue) { animate(); } }; layoutCbx.selectedProperty().addListener(cl); localCbx.selectedProperty().addListener(cl); parentCbx.selectedProperty().addListener(cl); effectGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) { relayout(); } }); layoutAnimateCbx.selectedProperty().addListener(cl2); localAnimateCbx.selectedProperty().addListener(cl2); parentAnimateCbx.selectedProperty().addListener(cl2); double w = 20.0; double h = 10.0; Rectangle rLayout = new Rectangle(w, h); rLayout.setFill(LAYOUT_BOUNDS_RECT_FILL_COLOR); rLayout.setStrokeWidth(BOUNDS_STROKE_WIDTH); rLayout.setStroke(LAYOUT_BOUNDS_RECT_STROKE_COLOR); Rectangle rLocal = new Rectangle(w, h); rLocal.setFill(LOCAL_BOUNDS_RECT_FILL_COLOR); rLocal.setStrokeWidth(BOUNDS_STROKE_WIDTH); rLocal.setStroke(LOCAL_BOUNDS_RECT_STROKE_COLOR); Rectangle rParent = new Rectangle(w, h); rParent.setFill(PARENT_BOUNDS_RECT_FILL_COLOR); rParent.setStrokeWidth(BOUNDS_STROKE_WIDTH); rParent.setStroke(PARENT_BOUNDS_RECT_STROKE_COLOR); GridPane gp = new GridPane(); gp.addRow(1, rLayout, new Text("Layout Bounds:"), layoutCbx, layoutAnimateCbx); gp.addRow(2, rLocal, new Text("Local Bounds:"), localCbx, localAnimateCbx); gp.addRow(3, rParent, new Text("Parent Bounds:"), parentCbx, parentAnimateCbx); TitledPane titledPane = new TitledPane("Show Bounds", gp); return titledPane; }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param iLargeur/*from w w w . j av a 2s . c o m*/ * @param iHauteur * @param bMasqueZones */ private static void afficheBarrePersonnalisee(int iLargeur, int iHauteur, boolean bMasqueZones) { apImgBarrePersonnalisee.getChildren().clear(); apZoneBarrePersonnalisee.getChildren().clear(); ImageView ivBarrePersonnalisee = new ImageView(imgBarrePersonnalisee); apImgBarrePersonnalisee.getChildren().add(ivBarrePersonnalisee); apImgBarrePersonnalisee.setPrefWidth(imgBarrePersonnalisee.getWidth()); apImgBarrePersonnalisee.setPrefHeight(imgBarrePersonnalisee.getHeight()); apImgBarrePersonnalisee.setCursor(Cursor.CROSSHAIR); apImgBarrePersonnalisee.setLayoutX((iLargeur - 300 - apImgBarrePersonnalisee.getPrefWidth()) / 2.d); apImgBarrePersonnalisee.setLayoutY((iHauteur - apImgBarrePersonnalisee.getPrefHeight()) / 2.d); if ((iNombreZones > 0) && !bMasqueZones) { for (int i = 0; i < iNombreZones; i++) { ZoneTelecommande zone = zones[i]; String[] strPoints = zone.getStrCoordonneesZone().split(","); double[] points = new double[strPoints.length]; for (int ij = 0; ij < strPoints.length; ij++) { points[ij] = Double.parseDouble(strPoints[ij]); } final String strIdZone = zone.getStrTypeZone() + "-" + i; switch (zone.getStrTypeZone()) { case "circle": Circle cercle = new Circle(points[0], points[1], points[2]); cercle.setFill(Color.rgb(255, 255, 0, 0.5)); cercle.setStroke(Color.FORESTGREEN); cercle.setCursor(Cursor.DEFAULT); apImgBarrePersonnalisee.getChildren().add(cercle); cercle.setId(strIdZone); cercle.setOnMouseClicked((t) -> { choixZone(iLargeur, iHauteur, bMasqueZones, strIdZone, t); t.consume(); }); break; case "rect": double largRect = points[2] - points[0]; double hautRect = points[3] - points[1]; Rectangle rect = new Rectangle(points[0], points[1], largRect, hautRect); rect.setFill(Color.rgb(255, 255, 0, 0.5)); rect.setStroke(Color.FORESTGREEN); rect.setCursor(Cursor.DEFAULT); apImgBarrePersonnalisee.getChildren().add(rect); rect.setId(strIdZone); rect.setOnMouseClicked((t) -> { choixZone(iLargeur, iHauteur, bMasqueZones, strIdZone, t); t.consume(); }); break; case "poly": Polygon poly = new Polygon(points); poly.setFill(Color.rgb(255, 255, 0, 0.5)); poly.setStroke(Color.FORESTGREEN); poly.setStrokeWidth(3); poly.setCursor(Cursor.DEFAULT); poly.setStrokeLineCap(StrokeLineCap.ROUND); poly.setId(strIdZone); apImgBarrePersonnalisee.getChildren().add(poly); poly.setOnMouseClicked((t) -> { choixZone(iLargeur, iHauteur, bMasqueZones, strIdZone, t); t.consume(); }); break; } } } }