Example usage for javafx.scene.shape Rectangle setArcWidth

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

Introduction

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

Prototype

public final void setArcWidth(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.setArcHeight(15);//from w w  w.j  a  v a  2  s  . c o  m
    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) {
    final Group group = new Group();
    Scene scene = new Scene(group, 300, 150);
    stage.setScene(scene);//from   ww w  .  ja  v  a 2  s.  c  om
    stage.setTitle("Sample");

    Rectangle rect = new Rectangle(100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(null);

    StrokeTransition st = new StrokeTransition(Duration.millis(3000), rect, Color.RED, Color.BLUE);

    st.setAutoReverse(true);

    st.play();

    group.getChildren().add(rect);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 500, 200);
    stage.setScene(scene);//from w w  w. j  a  v  a  2s .  c o  m

    Rectangle rect = new Rectangle(100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(Color.VIOLET);

    RotateTransition rt = new RotateTransition(Duration.millis(3000), rect);
    rt.setByAngle(180);
    rt.setAutoReverse(true);

    rt.play();

    root.getChildren().add(rect);

    stage.show();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 500, 200);
    stage.setScene(scene);//from  w ww .j  a  va  2 s.c o  m

    Rectangle rect = new Rectangle(100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(Color.VIOLET);

    ScaleTransition st = new ScaleTransition(Duration.millis(2000), rect);
    st.setByX(1.5f);
    st.setByY(1.5f);
    st.setAutoReverse(true);

    st.play();

    root.getChildren().add(rect);

    stage.show();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);/*from   w ww  . jav a2  s .co m*/

    VBox vb = new VBox();

    Rectangle rect = new Rectangle(100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(Color.VIOLET);

    RotateTransition rt = new RotateTransition(Duration.millis(3000), rect);
    rt.setByAngle(180);
    rt.setAutoReverse(true);
    SequentialTransition seqTransition = new SequentialTransition(new PauseTransition(Duration.millis(1000)), // wait a second
            rt);
    seqTransition.play();

    vb.getChildren().add(rect);
    scene.setRoot(vb);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Sample");
    stage.setWidth(300);/*ww w.  ja  v a 2  s. co  m*/
    stage.setHeight(190);

    VBox vbox = new VBox();
    vbox.setLayoutX(20);
    vbox.setLayoutY(20);

    Rectangle rect = new Rectangle(100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(Color.VIOLET);

    TranslateTransition tt = new TranslateTransition(Duration.millis(2000), rect);
    tt.setByX(200f);
    tt.setAutoReverse(true);

    tt.play();

    vbox.getChildren().add(rect);
    vbox.setSpacing(10);
    ((Group) scene.getRoot()).getChildren().add(vbox);

    stage.setScene(scene);
    stage.show();
}

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);
    roundRect.setArcHeight(60);/*from   ww  w  .j av  a2s.  c om*/

    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:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Rectangle r = new Rectangle();
    r.setX(50);//from w  w  w .  j  a  v  a 2s  . c om
    r.setY(50);
    r.setWidth(200);
    r.setHeight(100);
    r.setArcWidth(20);
    r.setArcHeight(20);

    root.getChildren().add(r);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);// w ww .  j av a  2 s  .  com

    VBox vb = new VBox();

    Rectangle rect = new Rectangle(100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(Color.VIOLET);

    final Duration SEC_2 = Duration.millis(2000);
    final Duration SEC_3 = Duration.millis(3000);

    FadeTransition ft = new FadeTransition(SEC_3);
    ft.setFromValue(1.0f);
    ft.setToValue(0.3f);

    ft.setAutoReverse(true);
    TranslateTransition tt = new TranslateTransition(SEC_2);
    tt.setFromX(-100f);
    tt.setToX(100f);

    tt.setAutoReverse(true);
    RotateTransition rt = new RotateTransition(SEC_3);
    rt.setByAngle(180f);

    rt.setAutoReverse(true);
    ScaleTransition st = new ScaleTransition(SEC_2);
    st.setByX(1.5f);
    st.setByY(1.5f);

    st.setAutoReverse(true);

    ParallelTransition pt = new ParallelTransition(rect, ft, tt, rt, st);
    pt.play();
    vb.getChildren().add(rect);

    scene.setRoot(vb);
    stage.show();
}

From source file:User.java

private Rectangle drawRectangleBackground() {
    Rectangle background = new Rectangle(320, 112);
    background.setX(0);//w  ww . ja v a 2s  .  co 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;
}