Example usage for javafx.scene.effect BoxBlur BoxBlur

List of usage examples for javafx.scene.effect BoxBlur BoxBlur

Introduction

In this page you can find the example usage for javafx.scene.effect BoxBlur BoxBlur.

Prototype

public BoxBlur() 

Source Link

Document

Creates a new instance of BoxBlur with default parameters.

Usage

From source file:Main.java

public static void startValueSetAnimation(final Pane parent) {
    final javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle();
    Insets margin = BorderPane.getMargin(parent);
    if (margin == null) {
        margin = new Insets(0);
    }/*from w w w. ja  va 2 s . co  m*/
    rectangle.widthProperty().bind(parent.widthProperty().subtract(margin.getLeft() + margin.getRight()));
    rectangle.heightProperty().bind(parent.heightProperty().subtract(margin.getTop() + margin.getBottom()));
    rectangle.setFill(Color.rgb(0, 150, 201));
    parent.getChildren().add(rectangle);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(3);
    rectangle.setEffect(bb);

    FadeTransition ft = new FadeTransition(Duration.millis(250), rectangle);
    ft.setFromValue(0.2);
    ft.setToValue(0.8);
    ft.setCycleCount(2);
    ft.setAutoReverse(true);
    ft.play();
    ft.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            parent.getChildren().remove(rectangle);
        }
    });
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");
    Group root = new Group();
    Scene scene = new Scene(root, 550, 250);

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);//w  ww.  ja  v a2  s. c  om
    text.setFill(Color.RED);
    root.getChildren().add(text);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(15);
    bb.setHeight(15);
    bb.setIterations(3);

    text.setEffect(bb);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Text Fonts");
    Group root = new Group();
    Scene scene = new Scene(root, 550, 250, Color.web("0x0000FF", 1.0));

    Text text = new Text(50, 100, "JavaFX 2.0 from Java2s.com");
    Font sanSerif = Font.font("Dialog", 30);
    text.setFont(sanSerif);/*from ww w.j a  v a 2s .  c o  m*/
    text.setFill(Color.RED);
    root.getChildren().add(text);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(15);
    bb.setHeight(15);
    bb.setIterations(3);

    text.setEffect(bb);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Text t1 = new Text("Drop Shadow!");
    t1.setFont(Font.font(24));//  ww w.  j a v a2 s. c o  m
    t1.setEffect(new DropShadow());

    Text t2 = new Text("Blur!");
    t2.setFont(Font.font(24));
    t2.setEffect(new BoxBlur());

    Text t3 = new Text("Glow!");
    t3.setFont(Font.font(24));
    t3.setEffect(new Glow());

    Text t4 = new Text("Bloom!");
    t4.setFont(Font.font("Arial", FontWeight.BOLD, 24));
    t4.setFill(Color.WHITE);
    t4.setEffect(new Bloom(0.10));

    Rectangle rect = new Rectangle(100, 30, Color.GREEN);
    StackPane spane = new StackPane(rect, t4);

    HBox root = new HBox(t1, t2, t3, spane);
    root.setSpacing(20);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Applying Effects");
    stage.show();
}

From source file:Main.java

static Node boxBlur() {
    Text t = new Text();
    t.setText("Blurry Text!");
    t.setFill(Color.RED);/*from w w  w .j  a  va 2 s  .c o m*/
    t.setFont(Font.font("null", FontWeight.BOLD, 36));
    t.setX(10);
    t.setY(40);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(3);

    t.setEffect(bb);
    t.setTranslateX(300);
    t.setTranslateY(100);

    return t;
}