Java 类javafx.scene.shape.Rectangle 实例源码

项目:GraphSpace    文件:TwoDimensionalProjectionTest.java   
@Test
public void testConstructor() {
    for (javafx.scene.Node node : projectionPane.getChildren()) {
        Rectangle square = (Rectangle) node;
        assertEquals(projection.getSideSize(), square.getHeight(), MAX_ERROR);
        assertEquals(projection.getSideSize(), square.getWidth(), MAX_ERROR);

        assertEquals(getX(node), square.getX(), MAX_ERROR);
        assertEquals(getY(node), square.getY(), MAX_ERROR);

        //assertEquals(Color.BLACK, square.getFill());
    }

    assertEquals(SCN_HEIGHT, projectionPane.getHeight(), MAX_ERROR);
    assertEquals(SCN_WIDTH, projectionPane.getWidth(), MAX_ERROR);
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureDigits() {
    for (int i : numbers) {
        digits[i] = new Text("0");
        digits[i].setFont(FONT);
        digits[i].setTextOrigin(VPos.TOP);
        digits[i].setLayoutX(2.3);
        digits[i].setLayoutY(-1);
        Rectangle background;
        if (i < 6) {
            background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
            digits[i].setFill(Color.web("#000000"));
        } else {
            background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
            digits[i].setFill(Color.web("#FFFFFF"));
        }
        digitsGroup[i] = new Group(background, digits[i]);
    }
}
项目:shuffleboard    文件:MecanumDriveWidget.java   
/**
 * Generates a mecanum drive base.
 *
 * @param wheelWidth  the width (or thickness) of the wheels
 * @param wheelHeight the height (or diameter) of the wheels
 * @param frameWidth  the width of the robot frame
 * @param frameHeight the height of the robot frame
 */
private static Shape generateMecanumDriveBase(double wheelWidth,
                                              double wheelHeight,
                                              double frameWidth,
                                              double frameHeight) {
  Rectangle frame = new Rectangle(wheelWidth, 0, frameWidth, frameHeight);
  frame.setFill(null);
  frame.setStroke(Color.WHITE);

  final Shape fl = mecanumWheel(wheelWidth, wheelHeight, MecanumWheelPos.FRONT_LEFT);
  final Shape fr = mecanumWheel(wheelWidth, wheelHeight, MecanumWheelPos.FRONT_RIGHT);
  final Shape rl = mecanumWheel(wheelWidth, wheelHeight, MecanumWheelPos.REAR_LEFT);
  final Shape rr = mecanumWheel(wheelWidth, wheelHeight, MecanumWheelPos.REAR_RIGHT);
  fr.setTranslateX(frameWidth + wheelWidth);
  rl.setTranslateY(frameHeight - wheelHeight);
  rr.setTranslateX(frameWidth + wheelWidth);
  rr.setTranslateY(frameHeight - wheelHeight);

  Shape combined = union(frame, fl, fr, rl, rr);
  combined.getStyleClass().addAll("robot-drive", "mecanum-drive");
  return combined;
}
项目:lttng-scope    文件:FadeTransitionEx.java   
@Override
public void start(Stage primaryStage) {
    if (primaryStage == null) {
        return;
    }

  Group group = new Group();
  Rectangle rect = new Rectangle(20,20,200,200);

  FadeTransition ft = new FadeTransition(Duration.millis(5000), rect);
  ft.setFromValue(1.0);
  ft.setToValue(0.0);
  ft.play();

  group.getChildren().add(rect);

  Scene scene = new Scene(group, 300, 200);
  primaryStage.setScene(scene);
  primaryStage.show();
}
项目:ExtremeGuiMakeover    文件:MovieApp.java   
private void showMasterDetailInWindow(final Stage stage, final Database database, final MasterDetailViewFeatures features) throws JAXBException, IOException {
    final Parent viewRoot = ViewFactory.createMasterDetailView(database, features);

    final Rectangle clip = new Rectangle();
    clip.setArcHeight(18);
    clip.setArcWidth(18);
    clip.widthProperty().bind(stage.widthProperty());
    clip.heightProperty().bind(stage.heightProperty());

    //TODO: Only clipping or PerspectiveCamera is working... :(
    features.customWindowClipProperty().addListener((obs, oldVal, newVal) -> {
        if (newVal) {
            viewRoot.setClip(clip);
        } else {
            viewRoot.setClip(null);
        }
    });

    final Scene scene = new Scene(viewRoot);

    features.useCssProperty().addListener((obs, oldVal, newVal) -> {
        updateStylesheets(scene, newVal);
    });

    updateStylesheets(scene, features.isUseCss());

    scene.setFill(Color.TRANSPARENT);
    scene.setCamera(new PerspectiveCamera());

    if (features.isCustomWindowUI()) {
        stage.initStyle(StageStyle.TRANSPARENT);
    }

    stage.setTitle("Movie Database");
    stage.setScene(scene);
    stage.setWidth(1100);
    stage.setHeight(720);
    stage.centerOnScreen();
    stage.show();

    final FeaturesDialog featuresDialog = new FeaturesDialog(stage);
    featuresDialog.addFeature(new Feature("Layout & Style", "demo2-css", features.useCssProperty()));
    featuresDialog.addFeature(new Feature("Image Background", "demo2-image-background",features.movieBackgroundProperty()));
    featuresDialog.addFeature(new Feature("List Animation", "demo2-list-animation",features.listAnimationProperty()));
    featuresDialog.addFeature(new Feature("List Shadow", "demo2-list-shadow",features.listShadowProperty()));
    // featuresDialog.addFeature(new Feature("List Cache", "demo2-list-cache",features.listCacheProperty()));
    featuresDialog.addFeature(new Feature("Poster Transform", "demo2-poster-transform",features.posterTransformProperty()));
    featuresDialog.addFeature(new Feature("Custom Window UI", "demo2-custom-window-ui",features.customWindowUIProperty()));
    featuresDialog.addFeature(new Feature("Custom Window Clip", "demo2-custom-window-clip", features.customWindowClipProperty()));
    featuresDialog.show();
}
项目:lttng-scope    文件:UiModelApp2.java   
private static void drawSelection(Group parent, Pane content) {
//        Rectangle selection1 = new Rectangle();
        Rectangle selection2 = new Rectangle();

        Stream.of(selection2).forEach(rect -> {
            rect.setMouseTransparent(true);

            rect.setStroke(SELECTION_STROKE_COLOR);
            rect.setStrokeWidth(SELECTION_STROKE_WIDTH);
            rect.setStrokeLineCap(StrokeLineCap.ROUND);
            rect.setFill(SELECTION_FILL_COLOR);

            rect.yProperty().bind(JfxUtils.ZERO_PROPERTY);
            rect.heightProperty().bind(content.heightProperty());
        });
//
//        selection1.setX(200);
//        selection1.setWidth(100);

        selection2.setX(500);
        selection2.setWidth(500);

        parent.getChildren().addAll(selection2);
    }
项目:lttng-scope    文件:UiModelApp.java   
private static void drawSelection(Group parent, Pane content) {
    Rectangle selection1 = new Rectangle();
    Rectangle selection2 = new Rectangle();

    Stream.of(selection1, selection2).forEach(rect -> {
        rect.setMouseTransparent(true);

        rect.setStroke(SELECTION_STROKE_COLOR);
        rect.setStrokeWidth(SELECTION_STROKE_WIDTH);
        rect.setStrokeLineCap(StrokeLineCap.ROUND);
        rect.setFill(SELECTION_FILL_COLOR);

        rect.yProperty().bind(JfxUtils.ZERO_PROPERTY);
        rect.heightProperty().bind(content.heightProperty());
    });

    selection1.setX(200);
    selection1.setWidth(100);

    selection2.setX(PANE_WIDTH - 1000);
    selection2.setWidth(500);

    parent.getChildren().addAll(selection1, selection2);
}
项目:octoBubbles    文件:PackageNodeView.java   
private void createRectangles(){
    top = new Rectangle();
    body = new Rectangle();
    changeHeight(getRefNode().getHeight());
    changeWidth(getRefNode().getWidth());

    top.setX(getRefNode().getX());
    top.setY(getRefNode().getY());
    top.setFill(Color.LIGHTSKYBLUE);
    top.setStroke(Color.BLACK);

    body.setX(getRefNode().getX());
    body.setY(getRefNode().getY() + top.getHeight());
    body.setFill(Color.LIGHTSKYBLUE);
    body.setStroke(Color.BLACK);

}
项目:PhotoScript    文件:Controller.java   
/**
 * 设置canvas大小
 */
private void setCanvasSize() {
    try {
        FXMLLoader fxmlLoader = new FXMLLoader((getClass().getResource("size_chooser.fxml")));
        Parent root1 = fxmlLoader.load();
        Stage stage = new Stage(DECORATED);
        stage.setTitle("选择画布");
        Scene scene = new Scene(root1);
        sizeChooser = fxmlLoader.getController();
        stage.setScene(scene);
        stage.showAndWait();
        if (sizeChooser.getCanvas() != null) {
            canvas.setHeight(sizeChooser.getCanvas().getHeight());
            canvas.setWidth(sizeChooser.getCanvas().getWidth());
            canvas.setLayoutX(450 - canvas.getWidth() / 2);
            canvas.setLayoutY(300 - canvas.getHeight() / 2);
            Rectangle rectangle = new Rectangle(canvas.getWidth(), canvas.getHeight());
            rectangle.setLayoutX(canvas.getLayoutX());
            rectangle.setLayoutY(canvas.getLayoutY());
            mainPane.setClip(rectangle);
            GraphicsContext gc = canvas.getGraphicsContext2D();
            gc.setFill(Color.WHITE);
            gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
        } else {
            //不选择就退出程序
            System.exit(0);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
项目:gemoc-studio-modeldebugging    文件:TimelineDiffViewerRenderer.java   
private void processSegments() {
    for (Map.Entry<HBox, List<List<DiffKind>>> e : lineToSegments.entrySet()) {
        final HBox line = e.getKey();
        final List<String> descriptions = segmentToDescription.get(line);
        final List<Node> children = line.getChildren();
        final List<List<DiffKind>> segments = e.getValue();
        int idx = 0;
        for (List<DiffKind> segment : segments) {
            if (segment == null) {
                final Rectangle rectangle = new Rectangle(WIDTH, 8, Color.TRANSPARENT);
                HBox.setMargin(rectangle, MARGIN_INSETS);
                children.add(rectangle);
            } else {
                DiffKind[] seg = new DiffKind[segment.size()];
                for (int i = 0; i < seg.length; i++) {
                    seg[i] = segment.get(i);
                }
                final String description = descriptions.get(idx);
                final ValueView view = new ValueView(description, seg);
                HBox.setMargin(view, MARGIN_INSETS);
                children.add(view);
                idx++;
            }
        }
    }
}
项目:java-solitaire    文件:StockPile.java   
private void addGroups() {
    int y = 5;
    int x = 5;
    for (int i = 0; i < 12; i++) {
        Rectangle temp = new Rectangle(146,194);
        temp.setArcHeight(15);
        temp.setArcWidth(15);
        String imageLocation = "/assets/card_assets/cards/backofHand.png";
        Image tempImage = new Image(imageLocation);
        temp.setFill(new ImagePattern(tempImage));
        temp.setStroke(Color.GRAY);
        temp.setVisible(true);
        temp.toFront();
        temp.setManaged(false);
        temp.setLayoutX(x);
        temp.setLayoutY(y);
        super.getChildren().add(temp);
        x-=1;
        y-=1;
    }
}
项目:GraphSpace    文件:TwoDimensionalProjectionTest.java   
@Test
public void testRunHard() {
    Thread projectionRenderThread = new Thread(timeLine);
    projectionRenderThread.start();

    timeInstant.revive(new Point(0, 0));
    timeInstant.revive(new Point(1, 1));
    timeInstant.revive(new Point(-1, -1));

    int centerRow = getCenterRow(projection);
    int centerColumn = getCenterColumn(projection);

    Rectangle centerSquare = (Rectangle) getNodeByRowColumnIndex(centerRow, centerColumn, projectionPane);
    //assertEquals(Color.BLACK, centerSquare.getFill());
    Rectangle squareOne = (Rectangle) getNodeByRowColumnIndex(centerRow + 1, centerColumn + 1, projectionPane);
    //assertEquals(Color.BLACK, centerSquare.getFill());
    Rectangle squareTwo = (Rectangle) getNodeByRowColumnIndex(centerRow - 1, centerColumn - 1, projectionPane);
    //assertEquals(Color.BLACK, centerSquare.getFill());

    projectionRenderThread.interrupt();
}
项目:JavaFX-EX    文件:ResizeSupportTest.java   
@Override
public void start(Stage stage) throws Exception {
  Scene scene = new Scene(new Group(rectangle = new Rectangle(100, 100)), 300, 300);
  rectangle.setLayoutX(100);
  rectangle.setLayoutY(100);
  stage.setScene(scene);
  stage.setAlwaysOnTop(true);
  stage.show();
  config = ResizeSupport.bind(rectangle);
}
项目:marathonv5    文件:ScaleSample.java   
public static Node createIconContent() {
    final Rectangle r1 = new Rectangle (50, 50, 14, 14);
    r1.setArcHeight(4);
    r1.setArcWidth(4);
    r1.setFill(Color.web("#ed4b00"));

    Polygon polygon = createArrow();
    polygon.setLayoutX(68);
    polygon.setLayoutY(25);
    polygon.setRotate(45);

    Rectangle r3 = new Rectangle (25, 25, 64, 64);
    r3.setArcHeight(15);
    r3.setArcWidth(15);
    r3.setFill(Color.web("#f49b00"));
    javafx.scene.Group g = new javafx.scene.Group(r3,r1, polygon);
    return new javafx.scene.Group(g);
}
项目:marathonv5    文件:VBoxSample.java   
public static Node createIconContent() {
    StackPane sp = new StackPane();
    VBox vbox = new VBox(3);
    vbox.setAlignment(Pos.CENTER);
    vbox.setPadding(new Insets(5, 5, 5, 5));

    Rectangle rectangle = new Rectangle(32, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    vbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
    Rectangle r1 = new Rectangle(18, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(18, 14, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(18, 20, Color.web("#349b00"));

    vbox.getChildren().addAll(r1, r2, r3);
    sp.getChildren().addAll(rectangle, vbox);
    return new Group(sp);
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureDigits() {
    for (int i : numbers) {
        digits[i] = new Text("0");
        digits[i].setFont(FONT);
        digits[i].setTextOrigin(VPos.TOP);
        digits[i].setLayoutX(2.3);
        digits[i].setLayoutY(-1);
        Rectangle background;
        if (i < 6) {
            background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
            digits[i].setFill(Color.web("#000000"));
        } else {
            background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
            digits[i].setFill(Color.web("#FFFFFF"));
        }
        digitsGroup[i] = new Group(background, digits[i]);
    }
}
项目:octoBubbles    文件:SequenceObjectView.java   
public SequenceObjectView(SequenceObject node) {
    super(node);

    container = new StackPane();
    rectangle = new Rectangle();
    title = new Label();

    initTitle();
    createRectangles();
    changeHeight(node.getHeight());
    changeWidth(node.getWidth());
    initLooks();

    this.getChildren().add(container);
    this.setTranslateX(node.getTranslateX());
    this.setTranslateY(node.getTranslateY());
    createHandles();
    createLifeline();
    createRectangleHandle();

    container.getChildren().addAll(rectangle, title);
}
项目:voogasalad-ltub    文件:ScreenMap.java   
private void makeGrid() {
    myGrid = new GridPane();
    myGrid.setMaxHeight(getScreenHeight());
    myGrid.setMaxWidth(getScreenWidth());
    for (int i = 0; i < getNumRows(); i++) {
        RowConstraints row = new RowConstraints(getScreenHeight()/getNumRows());
        myGrid.getRowConstraints().add(row);
    }
    for (int j = 0; j < getNumCols(); j++) {
        ColumnConstraints col = new ColumnConstraints(getScreenWidth()/getNumCols());
        myGrid.getColumnConstraints().add(col);
    }
    for (int i = 0; i < getNumRows(); i++) {
        for (int j = 0; j < getNumCols(); j++) {
            myGrid.add(new Rectangle(CELL_SIZE, CELL_SIZE, Color.WHITESMOKE), j, i);
        }
    }
    this.getChildren().clear();
    this.getChildren().add(myGrid);
}
项目:GazePlay    文件:Pictos.java   
public Picto(String name) {

            this.rectangle = new Rectangle();

            String soundResourceName = "pictogrammes/sounds/" + name + ".m4a";
            URL soundSourceResource = getClass().getClassLoader().getResource(soundResourceName);
            if (soundSourceResource == null) {
                throw new RuntimeException("Resource not found : " + soundResourceName);
            }

            this.sound = new AudioClip(soundSourceResource.toExternalForm());

            String imageResourceName = "pictogrammes/images/" + name + ".jpg";
            URL imageResource = getClass().getClassLoader().getResource(imageResourceName);
            if (imageResource == null) {
                throw new RuntimeException("Resource not found : " + imageResourceName);
            }
            rectangle.setFill(new ImagePattern(new Image(imageResource.toExternalForm()), 0, 0, 1, 1, true));
        }
项目:marathonv5    文件:FlowPaneSample.java   
public static Node createIconContent() {
    StackPane sp = new StackPane();
    FlowPane fp = new FlowPane();
    fp.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    fp.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle[] littleRecs = new Rectangle[4];
    Rectangle[] bigRecs = new Rectangle[4];
    for (int i = 0; i < 4; i++) {
        littleRecs[i] = new Rectangle(14, 14, Color.web("#1c89f4"));
        bigRecs[i] = new Rectangle(16, 12, Color.web("#349b00"));
        fp.getChildren().addAll(littleRecs[i], bigRecs[i]);
        FlowPane.setMargin(littleRecs[i], new Insets(2, 2, 2, 2));
    }
    sp.getChildren().addAll(rectangle, fp);
    return new Group(sp);
}
项目:marathonv5    文件:AnchorPaneSample.java   
public static Node createIconContent() {
    StackPane sp = new StackPane();
    AnchorPane anchorPane = new AnchorPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    anchorPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(45, 10, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(35, 14, Color.web("#349b00"));

    anchorPane.getChildren().addAll(r1, r2, r3);
    AnchorPane.setTopAnchor(r1, Double.valueOf(1));
    AnchorPane.setLeftAnchor(r1, Double.valueOf(1));
    AnchorPane.setTopAnchor(r2, Double.valueOf(20));
    AnchorPane.setLeftAnchor(r2, Double.valueOf(1));
    AnchorPane.setBottomAnchor(r3, Double.valueOf(1));
    AnchorPane.setRightAnchor(r3, Double.valueOf(5));

    sp.getChildren().addAll(rectangle, anchorPane);
    return new Group(sp);
}
项目:marathonv5    文件:TilePaneSample.java   
public static Node createIconContent() {
    StackPane sp = new StackPane();
    TilePane iconTilePane = new TilePane();
    iconTilePane.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    iconTilePane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle[] rec = new Rectangle[9];
    for (int i = 0; i < rec.length; i++) {
        rec[i] = new Rectangle(14, 14, Color.web("#349b00"));
        TilePane.setMargin(rec[i], new Insets(2, 2, 2, 2));
    }
    iconTilePane.getChildren().addAll(rec);
    sp.getChildren().addAll(rectangle, iconTilePane);
    return new Group(sp);
}
项目:marathonv5    文件:MultiTouchSample.java   
public MultiTouchPane() {
    clipRect = new Rectangle();
    clipRect.setSmooth(false);
    setClip(clipRect);

    Image post = new Image(MultiTouchSample.class.getResource("warning.png").toExternalForm(), false);
    postView = new ImageView(post);

    for (int i = 1; i <= 3; i++) {
        Image img = new Image(MultiTouchSample.class.getResource("animal" + i + ".jpg").toExternalForm(), false);
        MultiTouchImageView iv = new MultiTouchImageView(img);
        getChildren().add(iv);
    }

    getChildren().add(postView);
}
项目:FlappySpaceShip    文件:Wall.java   
/**
 * Creates a new instance of {@code Wall} with a given height and orientation.
 * @param height height of the pipe
 * @param orientation Orientation of the pipe
 */
public Wall(int height, int orientation) {

    this.height = height;
    this.orientation = orientation;

    Image img_0 = new Image(getClass().getResourceAsStream(pipe_0_URL));
    Image img_1 = new Image(getClass().getResourceAsStream(pipe_1_URL));

    rect = new Rectangle(pipeWidth, height);

    if (orientation == 0){
        rect.setFill(new ImagePattern(img_0, 0, 0, 1, 1, true));
    } else if (orientation == 1){
        rect.setFill(new ImagePattern(img_1, 0, 0, 1, 1, true));
    }

    getChildren().add(rect);
}
项目:marathonv5    文件:StrokeTransitionSample.java   
public StrokeTransitionSample() {
    super(150,150);
    Rectangle rect = new Rectangle(0, 0, 150, 150);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(null);
    rect.setStroke(Color.DODGERBLUE);
    rect.setStrokeWidth(10);
    getChildren().add(rect);

    strokeTransition = StrokeTransitionBuilder.create()
        .duration(Duration.seconds(3))
        .shape(rect)
        .fromValue(Color.RED)
        .toValue(Color.DODGERBLUE)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
项目:marathonv5    文件:RotateTransitionSample.java   
public RotateTransitionSample() {
    super(140,140);

    Rectangle rect = new Rectangle(20, 20, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.ORANGE);
    getChildren().add(rect);

    rotateTransition = RotateTransitionBuilder.create()
            .node(rect)
            .duration(Duration.seconds(4))
            .fromAngle(0)
            .toAngle(720)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:marathonv5    文件:TranslateSample.java   
public static Node createIconContent() {
    final Rectangle r1 = new Rectangle (0, 0, 20, 20);
    r1.setArcHeight(4);
    r1.setArcWidth(4);
    r1.setFill(Color.web("#ed4b00"));

    Polygon polygon = createArrow();
    polygon.setLayoutX(29);
    polygon.setLayoutY(21);
    polygon.setRotate(135);


    Rectangle r2 = new Rectangle (50, 50, 20, 20);
    r2.setArcHeight(4);
    r2.setArcWidth(4);
    r2.setFill(Color.web("#ed4b00"));
    r2.setOpacity(0.5);
    javafx.scene.Group g = new javafx.scene.Group(r2,r1, polygon);
    return new javafx.scene.Group(g);
}
项目:marathonv5    文件:ShearSample.java   
public ShearSample() {
    super(125,160);

    //create rectangle
    Rectangle rect = new Rectangle(75, 75, Color.web("#ed4b00", 0.5));
    rect.setTranslateY(50);

    Shear shear = new Shear(0.7, 0);
    rect.getTransforms().add(shear);

    //show the rectangles
    getChildren().addAll(rect);

    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Shear X", shear.xProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Shear Y", shear.yProperty(), 0d, 1d),
            new SimplePropertySheet.PropDesc("Shear Pivot X", shear.pivotXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Shear Pivot Y", shear.pivotYProperty(), 0d, 50d)
    );
    // END REMOVE ME

}
项目:marathonv5    文件:ScaleSample.java   
public static Node createIconContent() {
    final Rectangle r1 = new Rectangle (50, 50, 14, 14);
    r1.setArcHeight(4);
    r1.setArcWidth(4);
    r1.setFill(Color.web("#ed4b00"));

    Polygon polygon = createArrow();
    polygon.setLayoutX(68);
    polygon.setLayoutY(25);
    polygon.setRotate(45);

    Rectangle r3 = new Rectangle (25, 25, 64, 64);
    r3.setArcHeight(15);
    r3.setArcWidth(15);
    r3.setFill(Color.web("#f49b00"));
    javafx.scene.Group g = new javafx.scene.Group(r3,r1, polygon);
    return new javafx.scene.Group(g);
}
项目:CalendarFX    文件:WeekViewSkin.java   
public WeekViewSkin(WeekView view) {
    super(view);

    final InvalidationListener rebuildListener = it -> buildDays();
    view.numberOfDaysProperty().addListener(rebuildListener);
    view.adjustToFirstDayOfWeekProperty().addListener(rebuildListener);
    view.weekDayViewFactoryProperty().addListener(rebuildListener);

    buildDays();

    Rectangle clip = new Rectangle();
    clip.widthProperty().bind(view.widthProperty());
    clip.heightProperty().bind(view.heightProperty());
    view.setClip(clip);

    new DayViewEditController(view);

    getChildren().add(dayGridPane);
}
项目:Squid    文件:MassesAuditController.java   
private void displayMassStationsForReview() {

      int heightOfMassPlot = 150;

      // plotting mass variations
      // only show those with auto-centering on with count_time_sec > 0 in the run table at the mas station
      int widthOfView = squidProject.getPrawnFileRuns().size() * 25 + 350;
      scrolledAnchorPane.setPrefWidth(widthOfView + 150);

      int massCounter = 0;
      Map<Integer, MassStationDetail> mapOfIndexToMassStationDetails = PrawnFileUtilities.createMapOfIndexToMassStationDetails(squidProject.getPrawnFileRuns());
      for (Map.Entry<Integer, MassStationDetail> entry : mapOfIndexToMassStationDetails.entrySet()) {
          if (entry.getValue().autoCentered()) {
              AbstractDataView canvas
                      = new MassStationAuditViewForShrimp(new Rectangle(25, (massCounter * heightOfMassPlot) + 25, widthOfView, heightOfMassPlot),
                              entry.getValue().getMassStationLabel(),
                              entry.getValue().getMeasuredTrimMasses(),
                              entry.getValue().getTimesOfMeasuredTrimMasses(),
                              entry.getValue().getIndicesOfScansAtMeasurementTimes(),
                              entry.getValue().getIndicesOfRunsAtMeasurementTimes());

              scrolledAnchorPane.getChildren().add(canvas);
              GraphicsContext gc1 = canvas.getGraphicsContext2D();
              canvas.preparePanel();
              canvas.paint(gc1);

              massCounter++;

          }
      }
      scrolledAnchorPane.setPrefHeight((massCounter * heightOfMassPlot) + 50);
  }
项目:incubator-netbeans    文件:StopWatch.java   
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;
}
项目:incubator-netbeans    文件:StopWatch.java   
private void configureHand() {
    Circle circle = new Circle(0, 0, radius / 18);
    circle.setFill(color);
    Rectangle rectangle1 = new Rectangle(-0.5 - radius / 140, +radius / 7 - radius / 1.08, radius / 70 + 1, radius / 1.08);
    Rectangle rectangle2 = new Rectangle(-0.5 - radius / 140, +radius / 3.5 - radius / 7, radius / 70 + 1, radius / 7);
    rectangle1.setFill(color);
    rectangle2.setFill(Color.BLACK);
    hand.getChildren().addAll(circle, rectangle1, rectangle2);
}
项目:marathonv5    文件:ColorSample.java   
public static Node createIconContent() {
    double offset;
    Stop[] stops = new Stop[255];
    for (int y = 0; y < 255; y++) {
        offset = (double) (1.0 / 255) * y;
        int h = (int)((y / 255.0) * 360);
        stops[y] = new Stop(offset, Color.hsb(h, 0.8, 0.9));
    }
    Rectangle rect = new Rectangle(80,80,
            new LinearGradient(0f, 0f, 1f, 1f, true, CycleMethod.NO_CYCLE, stops));
    rect.setArcWidth(20);
    rect.setArcHeight(20);
    return rect;
}
项目:projectintern    文件:Door.java   
public void doorOpen() {
    // Draw trim
    Rectangle rgDT = new Rectangle(WIDTH, HEIGHT);
    rgDT.setFill(Color.TRANSPARENT);
    rgDT.setStroke(Color.web("4d2626"));
    rgDT.setStrokeWidth((WIDTH / (WIDTH / 2)));
    this.getChildren().add(rgDT);

    // Draw three hinges
    VBox vbHinges = new VBox(WIDTH / 3);
    Rectangle rgDH1 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH1.setFill(Color.web("a5a5a5"));
    Rectangle rgDH2 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH2.setFill(Color.web("a5a5a5"));
    Rectangle rgDH3 = new Rectangle((WIDTH / (WIDTH / 2)), (HEIGHT / (HEIGHT / 8)));
    rgDH3.setFill(Color.web("a5a5a5"));
    vbHinges.getChildren().addAll(rgDH1, rgDH2, rgDH3);
    vbHinges.setTranslateX(rgDH1.getWidth() / 2);
    vbHinges.setTranslateY(rgDH1.getHeight());
    this.getChildren().add(vbHinges);

    // Draw door
    Rectangle rgDD = new Rectangle(WIDTH - (WIDTH / (WIDTH / 4)) , HEIGHT);
    rgDD.setTranslateX((WIDTH / (WIDTH / 2)) - rgDD.getWidth());
    rgDD.setTranslateY((HEIGHT / (HEIGHT / 2)) / 2);
    rgDD.setFill(Color.web("673232"));
    this.getChildren().add(rgDD);
}
项目:marathonv5    文件:AudioClipSample.java   
public static Group createRectangle(Color color, double tx, double ty, double sx, double sy) {
    Group squareGroup = new Group();
    Rectangle squareShape = new Rectangle(1.0, 1.0);
    squareShape.setFill(color);
    squareShape.setTranslateX(-0.5);
    squareShape.setTranslateY(-0.5);
    squareGroup.getChildren().add(squareShape);
    squareGroup.setTranslateX(tx);
    squareGroup.setTranslateY(ty);
    squareGroup.setScaleX(sx);
    squareGroup.setScaleY(sy);
    return squareGroup;
}
项目:incubator-netbeans    文件:TransitionPath.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 400,260));
    Rectangle rect = new Rectangle (0, 0, 40, 40);
    rect.setArcHeight(10);
    rect.setArcWidth(10);
    rect.setFill(Color.ORANGE);
    root.getChildren().add(rect);
    Path path = PathBuilder.create()
            .elements(
                new MoveTo(20,20),
                new CubicCurveTo(380, 0, 380, 120, 200, 120),
                new CubicCurveTo(0, 120, 0, 240, 380, 240)
            )
            .build();
    path.setStroke(Color.DODGERBLUE);
    path.getStrokeDashArray().setAll(5d,5d);
    root.getChildren().add(path);

    pathTransition = PathTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .path(path)
            .node(rect)
            .orientation(OrientationType.ORTHOGONAL_TO_TANGENT)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:incubator-netbeans    文件:Xylophone.java   
public static Group createRectangle(Color color, double tx, double ty, double sx, double sy) {
    Group squareGroup = new Group();
    Rectangle squareShape = new Rectangle(1.0, 1.0);
    squareShape.setFill(color);
    squareShape.setTranslateX(-0.5);
    squareShape.setTranslateY(-0.5);
    squareGroup.getChildren().add(squareShape);
    squareGroup.setTranslateX(tx);
    squareGroup.setTranslateY(ty);
    squareGroup.setScaleX(sx);
    squareGroup.setScaleY(sy);
    return squareGroup;
}
项目:lttng-scope    文件:Example.java   
@Override
public void start(Stage stage) {
    Node content = new Rectangle(1000, 700, Color.GREEN);
    ScrollPane scrollPane = new ScrollPane(content);
    scrollPane.setPrefSize(500, 300);

    ChangeListener<Object> changeListener = new ChangeListener<Object>() {
        @Override
        public void changed(ObservableValue<? extends Object> observable, Object oldValue, Object newValue) {
            double hmin = scrollPane.getHmin();
            double hmax = scrollPane.getHmax();
            double hvalue = scrollPane.getHvalue();
            double contentWidth = content.getLayoutBounds().getWidth();
            double viewportWidth = scrollPane.getViewportBounds().getWidth();

            double hoffset =
                Math.max(0, contentWidth - viewportWidth) * (hvalue - hmin) / (hmax - hmin);

            double vmin = scrollPane.getVmin();
            double vmax = scrollPane.getVmax();
            double vvalue = scrollPane.getVvalue();
            double contentHeight = content.getLayoutBounds().getHeight();
            double viewportHeight = scrollPane.getViewportBounds().getHeight();

            double voffset =
                Math.max(0,  contentHeight - viewportHeight) * (vvalue - vmin) / (vmax - vmin);

            System.out.printf("Offset: [%.1f, %.1f] width: %.1f height: %.1f %n",
                    hoffset, voffset, viewportWidth, viewportHeight);
        }
    };
    scrollPane.viewportBoundsProperty().addListener(changeListener);
    scrollPane.hvalueProperty().addListener(changeListener);
    scrollPane.vvalueProperty().addListener(changeListener);

    Scene scene = new Scene(scrollPane, 640, 480);
    stage.setScene(scene);

    stage.show();
}
项目:H-Uppaal    文件:ArrowHead.java   
public ArrowHead() {
    // Calculate the rotation body (a fix to move the point of rotation)
    Rectangle rotationBody = new Rectangle();
    rotationBody.xProperty().bind(xProperty().subtract(getHeadWidth() / 2));
    rotationBody.yProperty().bind(yProperty().subtract(getHeadHeight()));
    rotationBody.widthProperty().set(getHeadWidth());
    rotationBody.heightProperty().set(getHeadHeight() * 2);
    rotationBody.setMouseTransparent(true);
    rotationBody.setFill(Color.TRANSPARENT);

    // Add the body to the head
    getChildren().add(rotationBody);
}