Java Code Examples for javafx.scene.paint.Color#WHITESMOKE

The following examples show how to use javafx.scene.paint.Color#WHITESMOKE . 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: RadialGradientSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);
    
    // show the circles
    getChildren().addAll(hb);
}
 
Example 2
Source File: RadialGradientSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public RadialGradientSample() {
    //create simple radial gradient
    RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0, Color.DODGERBLUE),
        new Stop(1, Color.BLACK)
    });
    Circle circle1 = new Circle(45, 45, 40, gradient1);

    //create complex radial gradient
    RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
        new Stop(0,  Color.TRANSPARENT),
        new Stop(0.5,  Color.DARKGRAY),
        new Stop(0.64, Color.WHITESMOKE),
        new Stop(0.65, Color.YELLOW),
        new Stop(1, Color.GOLD)
    });
    Circle circle2 = new Circle(145, 45, 40, gradient2);

    HBox hb = new HBox(10);
    hb.getChildren().addAll(circle1, circle2);
    
    // show the circles
    getChildren().addAll(hb);
}
 
Example 3
Source File: CustomNodeSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public MyEnsembleNode(String name) {
  text = new Text(name);
  text.setTextOrigin(VPos.TOP);
  text.setLayoutX(4);
  text.setLayoutY(2);
  rectangle = new Rectangle(50, 20, Color.WHITESMOKE);
  rectangle.setStroke(Color.BLACK);
  //add nodes as childrens, order matters, first is on the bottom
  getChildren().addAll(rectangle, text);
}
 
Example 4
Source File: CustomNodeSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public MyEnsembleNode(String name) {
  text = new Text(name);
  text.setTextOrigin(VPos.TOP);
  text.setLayoutX(4);
  text.setLayoutY(2);
  rectangle = new Rectangle(50, 20, Color.WHITESMOKE);
  rectangle.setStroke(Color.BLACK);
  //add nodes as childrens, order matters, first is on the bottom
  getChildren().addAll(rectangle, text);
}
 
Example 5
Source File: DialogsApp.java    From FXTutorials with MIT License 4 votes vote down vote up
CustomDialog(String header, String content) {
    Pane root = new Pane();

    scale1.setFromX(0.01);
    scale1.setFromY(0.01);
    scale1.setToY(1.0);
    scale1.setDuration(Duration.seconds(0.33));
    scale1.setInterpolator(EXP_IN);
    scale1.setNode(root);

    scale2.setFromX(0.01);
    scale2.setToX(1.0);
    scale2.setDuration(Duration.seconds(0.33));
    scale2.setInterpolator(EXP_OUT);
    scale2.setNode(root);

    initStyle(StageStyle.TRANSPARENT);
    initModality(Modality.APPLICATION_MODAL);

    Rectangle bg = new Rectangle(350, 150, Color.WHITESMOKE);
    bg.setStroke(Color.BLACK);
    bg.setStrokeWidth(1.5);

    Text headerText = new Text(header);
    headerText.setFont(Font.font(20));

    Text contentText = new Text(content);
    contentText.setFont(Font.font(16));

    VBox box = new VBox(10,
            headerText,
            new Separator(Orientation.HORIZONTAL),
            contentText
    );
    box.setPadding(new Insets(15));

    Button btn = new Button("OK");
    btn.setTranslateX(bg.getWidth() - 50);
    btn.setTranslateY(bg.getHeight() - 50);
    btn.setOnAction(e -> closeDialog());

    root.getChildren().addAll(bg, box, btn);

    setScene(new Scene(root, null));
}