[英]Weird corners in Tab headers in JavaFX
我在 Tab 標題中有奇怪的角。 這是我的 Java 代碼:
public class JavaFxTest1 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
var tabPane = new TabPane();
VBox.setVgrow(tabPane, Priority.ALWAYS);
primaryStage.setTitle("Hello World!");
Button button = new Button();
button.setText("NewTab");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
Tab tab = new Tab("New tab");
var content = new VBox();
tab.setContent(content);
var splitPane = new SplitPane();
VBox.setVgrow(splitPane, Priority.ALWAYS);
content.getChildren().add(splitPane);
splitPane.getItems().addAll(new TextArea("One two three"), new TextArea("One two three"));
tabPane.getTabs().add(tab);
}
});
VBox root = new VBox();
root.getChildren().addAll(tabPane, button);
var css= this.getClass().getResource("test1.css").toExternalForm();
var scene = new Scene(root, 800, 600);
scene.getStylesheets().add(css);
primaryStage.setScene(scene);
primaryStage.show();
}
}
這是 CSS 代碼:
.tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-label {
-fx-alignment: center;
-fx-text-fill: -fx-text-base-color;
-fx-padding:0 10 0 0;
-fx-font-size: 15px;
}
.tab-header-area .tab {
-fx-padding:4 10 5 10;
-fx-border-radius: 10 10 0 0;
-fx-background-radius: 10 10 0 0;
}
這是 Linux 的結果(linux 為 19-ea+3,JDK:openjdk 版本“14.0.2”2020-07-1,操作系統:Ubuntu 20.04.3 LTS):
這是 JavaFX 團隊復制的錯誤。 問題在這里
Windows 7 不是 JDK 18 支持的配置 - https://www.oracle.com/java/technologies/javase/products-doc-jdk18certconfig.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.