Example usage for javafx.scene.shape Rectangle setStrokeWidth

List of usage examples for javafx.scene.shape Rectangle setStrokeWidth

Introduction

In this page you can find the example usage for javafx.scene.shape Rectangle setStrokeWidth.

Prototype

public final void setStrokeWidth(double value) 

Source Link

Usage

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);

    rect.setStroke(Color.RED);/* w w  w.ja  va2  s.  com*/
    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);

    rect.setStroke(Color.RED);/*from   w  w w  .  j  av a  2 s  . c  o  m*/
    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 stage) {
    Button btn = new Button("A big button");

    Rectangle rect = new Rectangle(100, 50);
    rect.setFill(Color.WHITE);//from  w w w  . j a va 2s . com
    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);//  w w  w .  j  a v  a2 s. c  om
    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);//  www. j  ava2  s  .  c om
    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 TitledPane getShowBoundsControls() {
    ChangeListener<Boolean> cl = new ChangeListener<Boolean>() {
        @Override/* w w  w  .j a v a  2 s .  c o 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:snpviewer.SnpViewer.java

private void drawRegionSummary(RegionSummary reg, String currentChrom) {
    if (currentChrom == null) {
        if (reg.getChromosome() != null) {
            currentChrom = reg.getChromosome();
        } else {//from   www.j av  a2 s . c o m
            return;
        }
    }
    ChromosomeLength chromLength;
    try {
        chromLength = new ChromosomeLength(genomeVersion);
    } catch (Exception ex) {
        chromLength = new ChromosomeLength();
    }
    double x;
    double width;
    double cLength;
    try {
        cLength = chromLength.getLength(currentChrom);
    } catch (Exception ex) {
        ex.printStackTrace();
        return;
    }
    int startPos = reg.getStartPos();
    int rLength = reg.getLength();
    x = chromSplitPane.getWidth() / cLength * startPos;
    width = chromSplitPane.getWidth() / cLength * rLength;

    Rectangle regionRectangle = new Rectangle();
    regionRectangle.setX(x);
    regionRectangle.setWidth(width);
    regionRectangle.setY(0);
    regionRectangle.xProperty().bind(selectionOverlayPane.widthProperty().divide(cLength).multiply(startPos));
    regionRectangle.heightProperty().bind(selectionOverlayPane.heightProperty());
    regionRectangle.widthProperty()
            .bind(selectionOverlayPane.widthProperty().divide(cLength).multiply(rLength));
    regionRectangle.strokeProperty().set(colorComp.get(Colors.saveLine.value));
    regionRectangle.fillProperty().set(colorComp.get(Colors.saveFill.value));
    regionRectangle.setOpacity(0.40);
    regionRectangle.setStrokeWidth(2);
    savedRegionsDisplay.add(regionRectangle);
    savedRegionsReference.add(reg);
}