Java Code Examples for javafx.scene.shape.Rectangle#setRotate()
The following examples show how to use
javafx.scene.shape.Rectangle#setRotate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RotateSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public static Node createIconContent() { final Rectangle r1 = new Rectangle (0, 0, 64, 64); r1.setArcHeight(4); r1.setArcWidth(4); r1.setFill(Color.web("#ed4b00")); Polygon polygon = createArrow(); polygon.setLayoutX(65); polygon.setLayoutY(5); polygon.setRotate(165); Rectangle r2 = new Rectangle (0, 0, 64, 64); r2.setArcHeight(15); r2.setArcWidth(15); r2.setFill(Color.web("#ed4b00")); r2.setRotate(60); r2.setOpacity(0.5); javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon); return new javafx.scene.Group(g); }
Example 2
Source File: RotateSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public static Node createIconContent() { final Rectangle r1 = new Rectangle (0, 0, 64, 64); r1.setArcHeight(4); r1.setArcWidth(4); r1.setFill(Color.web("#ed4b00")); Polygon polygon = createArrow(); polygon.setLayoutX(65); polygon.setLayoutY(5); polygon.setRotate(165); Rectangle r2 = new Rectangle (0, 0, 64, 64); r2.setArcHeight(15); r2.setArcWidth(15); r2.setFill(Color.web("#ed4b00")); r2.setRotate(60); r2.setOpacity(0.5); javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon); return new javafx.scene.Group(g); }
Example 3
Source File: RectangleSegmentHandlePart.java From gef with Eclipse Public License 2.0 | 6 votes |
@Override protected void updateLocation(Rectangle visual) { super.updateLocation(visual); BezierCurve bezierSegmentInParent = getBezierSegmentInParent(); if (bezierSegmentInParent == null) { return; } Point direction = bezierSegmentInParent.getDerivative() .get(getSegmentParameter()); Vector directionVector = new Vector(direction.x, direction.y); if (directionVector.isNull()) { return; } Vector xVector = new Vector(1, 0); Angle angleCcw = xVector.getAngleCCW(directionVector); visual.setRotate(angleCcw.deg()); }
Example 4
Source File: RotateSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public RotateSample() { super(220, 270); //create 2 rectangles Rectangle rect1 = new Rectangle(90, 90, Color.web("#ed4b00", 0.75)); Rectangle rect2 = new Rectangle(90, 90, Color.web("#ed4b00", 0.5)); //rotate the second one rect2.getTransforms().add(new Rotate(135, 90, 90)); // parameters are angle, pivotX and pivotY // rectangle with adjustable rotate Rectangle rect3 = new Rectangle(40, 180, 60, 60); rect3.setFill(Color.DODGERBLUE); rect3.setArcWidth(10); rect3.setArcHeight(10); rect3.setRotate(45); //show the rectangles getChildren().addAll(rect2, rect1, rect3); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Rotate", rect3.rotateProperty(), 0d, 360d) ); // END REMOVE ME //create arrow Polygon polygon = createArrow(); polygon.setLayoutX(110); polygon.setLayoutY(15); polygon.setRotate(135); getChildren().addAll(polygon); }
Example 5
Source File: StopWatchSample.java From marathonv5 with Apache License 2.0 | 5 votes |
private Rectangle createTic(double angle, double width, double height) { Rectangle rectangle = new Rectangle(-width / 2, -height / 2, width, height); rectangle.setFill(Color.rgb(10, 10, 10)); rectangle.setRotate(angle); rectangle.setLayoutX(radius * Math.cos(Math.toRadians(angle))); rectangle.setLayoutY(radius * Math.sin(Math.toRadians(angle))); return rectangle; }
Example 6
Source File: RotateSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public RotateSample() { super(220, 270); //create 2 rectangles Rectangle rect1 = new Rectangle(90, 90, Color.web("#ed4b00", 0.75)); Rectangle rect2 = new Rectangle(90, 90, Color.web("#ed4b00", 0.5)); //rotate the second one rect2.getTransforms().add(new Rotate(135, 90, 90)); // parameters are angle, pivotX and pivotY // rectangle with adjustable rotate Rectangle rect3 = new Rectangle(40, 180, 60, 60); rect3.setFill(Color.DODGERBLUE); rect3.setArcWidth(10); rect3.setArcHeight(10); rect3.setRotate(45); //show the rectangles getChildren().addAll(rect2, rect1, rect3); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Rotate", rect3.rotateProperty(), 0d, 360d) ); // END REMOVE ME //create arrow Polygon polygon = createArrow(); polygon.setLayoutX(110); polygon.setLayoutY(15); polygon.setRotate(135); getChildren().addAll(polygon); }
Example 7
Source File: StopWatchSample.java From marathonv5 with Apache License 2.0 | 5 votes |
private Rectangle createTic(double angle, double width, double height) { Rectangle rectangle = new Rectangle(-width / 2, -height / 2, width, height); rectangle.setFill(Color.rgb(10, 10, 10)); rectangle.setRotate(angle); rectangle.setLayoutX(radius * Math.cos(Math.toRadians(angle))); rectangle.setLayoutY(radius * Math.sin(Math.toRadians(angle))); return rectangle; }
Example 8
Source File: StopWatch.java From netbeans with Apache License 2.0 | 5 votes |
private Rectangle createTic(double angle, double width, double height) { Rectangle rectangle = new Rectangle(-width / 2, -height / 2, width, height); rectangle.setFill(Color.rgb(10, 10, 10)); rectangle.setRotate(angle); rectangle.setLayoutX(radius * Math.cos(Math.toRadians(angle))); rectangle.setLayoutY(radius * Math.sin(Math.toRadians(angle))); return rectangle; }
Example 9
Source File: CubeViewer.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
private void buildPanels(double size) { //@SMP TODO might be easier to just replace the Rectangle side panels with really flat Box 3D objects x1AxisRectangle = new Rectangle(size, size, x1AxisRectangleColor); x2AxisRectangle = new Rectangle(size, size, x2AxisRectangleColor); y1AxisRectangle = new Rectangle(size, size, y1AxisRectangleColor); y2AxisRectangle = new Rectangle(size, size, y2AxisRectangleColor); z1AxisRectangle = new Rectangle(size, size, z1AxisRectangleColor); z2AxisRectangle = new Rectangle(size, size, z2AxisRectangleColor); x1AxisRectangle.setTranslateX(-size / 2); x1AxisRectangle.setTranslateY(-size / 2); x1AxisRectangle.setTranslateZ(-size / 2); x2AxisRectangle.setTranslateX(-size / 2); x2AxisRectangle.setTranslateY(-size / 2); x2AxisRectangle.setTranslateZ(size / 2); getChildren().addAll(x1AxisRectangle, x2AxisRectangle); y2AxisRectangle.setTranslateY(-size / 2); y2AxisRectangle.setRotationAxis(Rotate.Y_AXIS); y2AxisRectangle.setRotate(89.9); y1AxisRectangle.setTranslateX(-size); y1AxisRectangle.setTranslateY(-size / 2); y1AxisRectangle.setRotationAxis(Rotate.Y_AXIS); y1AxisRectangle.setRotate(89.9); getChildren().addAll(y1AxisRectangle, y2AxisRectangle); z1AxisRectangle.setTranslateX(-size / 2); z1AxisRectangle.setRotationAxis(Rotate.X_AXIS); z1AxisRectangle.setRotate(89.9); z2AxisRectangle.setTranslateX(-size / 2); z2AxisRectangle.setTranslateY(-size); z2AxisRectangle.setRotationAxis(Rotate.X_AXIS); z2AxisRectangle.setRotate(89.9); getChildren().addAll(z1AxisRectangle, z2AxisRectangle); }
Example 10
Source File: CubeWorld.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
private void buildPanels(double size) { //@SMP TODO might be easier to just replace the Rectangle side panels with really flat Box 3D objects x1AxisRectangle = new Rectangle(size, size, panelWallColor); x2AxisRectangle = new Rectangle(size, size, panelWallColor); y1AxisRectangle = new Rectangle(size, size, panelWallColor); y2AxisRectangle = new Rectangle(size, size, panelWallColor); z1AxisRectangle = new Rectangle(size, size, panelFloorColor); z2AxisRectangle = new Rectangle(size, size, panelCeilingColor); x1AxisRectangle.setTranslateX(-size / 2); x1AxisRectangle.setTranslateY(-size / 2); x1AxisRectangle.setTranslateZ(-size / 2); x2AxisRectangle.setTranslateX(-size / 2); x2AxisRectangle.setTranslateY(-size / 2); x2AxisRectangle.setTranslateZ(size / 2); getChildren().addAll(x1AxisRectangle, x2AxisRectangle); y2AxisRectangle.setTranslateY(-size / 2); y2AxisRectangle.setRotationAxis(Rotate.Y_AXIS); y2AxisRectangle.setRotate(89.9); y1AxisRectangle.setTranslateX(-size); y1AxisRectangle.setTranslateY(-size / 2); y1AxisRectangle.setRotationAxis(Rotate.Y_AXIS); y1AxisRectangle.setRotate(89.9); getChildren().addAll(y1AxisRectangle, y2AxisRectangle); z1AxisRectangle.setTranslateX(-size / 2); z1AxisRectangle.setRotationAxis(Rotate.X_AXIS); z1AxisRectangle.setRotate(89.9); z2AxisRectangle.setTranslateX(-size / 2); z2AxisRectangle.setTranslateY(-size); z2AxisRectangle.setRotationAxis(Rotate.X_AXIS); z2AxisRectangle.setRotate(89.9); getChildren().addAll(z1AxisRectangle, z2AxisRectangle); }
Example 11
Source File: ChatBubble.java From dolphin-platform with Apache License 2.0 | 4 votes |
public ChatBubble() { getStyleClass().addAll("chat-bubble-wrapper"); mainBubble = new Rectangle(); mainBubble.getStyleClass().addAll("chat-bubble", "chat-bubble-rect"); mainBubble.setManaged(false); mySpeakerSign = new Rectangle(); mySpeakerSign.getStyleClass().add("chat-bubble"); mySpeakerSign.setRotate(45.0); mySpeakerSign.setManaged(false); oppositeSpeakerSign = new Rectangle(); oppositeSpeakerSign.getStyleClass().add("chat-bubble"); oppositeSpeakerSign.setRotate(45.0); oppositeSpeakerSign.setManaged(false); chatText = new Label(); chatText.setWrapText(true); chatText.getStyleClass().add("chat-text"); getChildren().addAll(mainBubble, mySpeakerSign, oppositeSpeakerSign, chatText); sendByMe.addListener(e -> { if(isSendByMe()) { setChatPseudoClass(mePseudoClass, true); setChatPseudoClass(oppositePseudoClass, false); } else { setChatPseudoClass(mePseudoClass, false); setChatPseudoClass(oppositePseudoClass, true); } }); mySpeakerSign.visibleProperty().bind(sendByMe); oppositeSpeakerSign.visibleProperty().bind(sendByMe.not()); chatText.textProperty().bind(message); setMaxHeight(USE_PREF_SIZE); setMinHeight(USE_PREF_SIZE); setMinWidth(0); }