JavaFX Mitered Border Effect | بلاگ

JavaFX Mitered Border Effect

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

What are my options to make my borders render similar to the below photo. I'm fairly new to styling with JavaFX but I feel comfortable using the API as well as JavaFX CSS. Example of desired border mitering

import javafx.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.stage.*;

public class Foobar extends Application {
  @Override
  public void start(Stage stage) {
    // Just setup to create a sane testing ground
    HBox hbox = new HBox();
    Region region = new Region();
    region.setStyle(
      "-fx-pref-width: 350px;" +
      "-fx-pref-height: 200px;"
    );
    hbox.getChildren().add(region);

    // Add a border style to the hbox
    hbox.setStyle(
      "-fx-border-color: black blue black blue;" +
      "-fx-border-width: 16px;" +
      "-fx-border-radius: 0px;" +
      "-fx-border-insets: 0px;" +
      "-fx-border-style: solid;"
    );

    // Show the stage
    VBox root = new VBox();
    root.setStyle("-fx-background-color: silver");
    root.getChildren().add(hbox);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
  }
}

Output:
Program output

asked 46 secs ago
FireLight

...
نویسنده : استخدام کار بازدید : 10 تاريخ : شنبه 11 فروردين 1397 ساعت: 10:05