0

我创建了一个 JavaFX 应用程序(在 Ubuntu、Java(TM) SE 运行时环境(build 1.8.0_131-b11)上运行)并制作了一个简单的测试应用程序:

  public class DelayedSceneApplication extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Test");
        primaryStage.setResizable(false);

        // Root.
        BorderPane root = new BorderPane();
        Scene scene = new Scene(root);
        primaryStage.setScene(scene);

        // Buttons box.
        HBox buttonBox = new HBox();
        buttonBox.setPadding(new Insets(10));
        buttonBox.getChildren().addAll(new Button("Test"));

        root.setBottom(buttonBox);
        primaryStage.show();
    }
  }

问题是有时,在舞台显示后,场景没有加载。有时显示按钮需要一秒钟,有时超过 20 秒。当场景尚未显示并单击场景时,按钮立即显示。同样,有时按钮在启动时正确显示。正如随机提到的,这种情况会发生。要重现此行为,必须多次重新启动应用程序。我在哪里做错了?是虫子吗?在其他环境(Windows,其他 JAVA 版本,...)中是否可能无法重现?

非常感谢!

更新: 带有-Dprism.verbose=true选项的输出:

Prism pipeline init order: es2 sw 
Using java-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
    succeeded.
GLFactory using com.sun.prism.es2.X11GLFactory
(X) Got class = class com.sun.prism.es2.ES2Pipeline
Initialized prism pipeline: com.sun.prism.es2.ES2Pipeline
Maximum supported texture size: 16384
Maximum texture size clamped to 4096
Non power of two texture support = true
Maximum number of vertex attributes = 16
Maximum number of uniform vertex components = 16384
Maximum number of uniform fragment components = 16384
Maximum number of varying components = 128
Maximum number of texture units usable in a vertex shader = 32
Maximum number of texture units usable in a fragment shader = 32
Graphics Vendor: Intel Open Source Technology Center
       Renderer: Mesa DRI Intel(R) Kabylake GT2 
        Version: 3.0 Mesa 17.0.3
 vsync: true vpipe: true
ES2ResourceFactory: Prism - createStockShader: FillPgram_Color.frag
new alphas
ES2ResourceFactory: Prism - createStockShader: Texture_Color.frag
ES2ResourceFactory: Prism - createStockShader: Texture_LinearGradient_PAD.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureRGB.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureFirstPassLCD.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureSecondPassLCD.frag
4

0 回答 0