我创建了一个 JavaFX 应用程序(在 Ubuntu、Java™ SE 运行时环境(版本 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 版本...)中重现?
非常感谢!
Update:输出与-Dprism.verbose=true
option:
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
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)