JavaFX - 在渲染大量文本时可视化调整大小

时间:2018-05-20 19:31:39

标签: java javafx javafx-8

在调整具有大量Text组件的容器时,有没有办法消除这种视觉故障?是什么造成的?

enter image description here

使用的代码:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class ResizeTest extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        Pane root = new Pane();

        for (int i = 0; i < 60; i++) {
            for (int j = 0; j < 100; j++) {
                Text t = new Text("A");
                t.setY(i * 15);
                t.setX(j * 10);
                root.getChildren().add(t);
            }
        }

        Scene scene = new Scene(root, 400, 200);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

这是在Linux Mint PC上显示的。

0 个答案:

没有答案
相关问题