Java 升级后 OSX 上的 JavaFX 渲染问题 [英] JavaFX rendering issue on OSX after java upgrade

查看:15
本文介绍了Java 升级后 OSX 上的 JavaFX 渲染问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的带有 javafx 3D 对象的应用程序运行良好,直到我将 java 从 8u51 升级到 8u60.升级后,UI颠倒显示.这是我使用以下测试代码得到的结果.似乎 y 轴在渲染中反转,但在功能中没有反转.

我尝试将 -Dprism.order=sw 作为 VM 选项.这解决了测试问题,但随后不允许渲染 javafx 3D 对象.

有谁知道如何解决这个 java/javafx 问题.我会尝试下载并安装Java 8u51.

请注意,我已阅读

import javafx.application.Application;导入 javafx.scene.PerspectiveCamera;导入 javafx.scene.SceneAntialiasing;导入 javafx.scene.control.*;导入 javafx.scene.layout.BorderPane;导入 javafx.scene.layout.VBox;导入 javafx.stage.Stage;导入 javafx.scene.Scene;公共类 TestAppj 扩展应用程序 {public static void main(String[] args) { Application.launch(args);}公共无效开始(阶段primaryStage){primaryStage.setTitle("测试阶段");TabPane tabbedPane = new TabPane(new Tab("Tools", new BorderPane()), new Tab("Things", new BorderPane()));MenuBar menuBar = new MenuBar(new Menu("File", null, new MenuItem("Open"), new MenuItem("New"), new MenuItem("Save")),new Menu("Edit", null, new MenuItem("Cut"), new MenuItem("Copy"), new MenuItem("Paste")));BorderPane root = new BorderPane();root.setTop(new VBox(menuBar, new ToolBar()));root.setCenter(tabbedPane);Scene theScene = new Scene(root, 500, 500, true, SceneAntialiasing.BALANCED);theScene.setCamera(new PerspectiveCamera());primaryStage.setScene(theScene);primaryStage.show();}}

解决方案

这是在 Mac 上重现您在 8u60 上发现的错误的更短方法:

@Override公共无效开始(阶段primaryStage){Scene scene = new Scene(new StackPane(new Label("Antialising
Balanced")),300, 300, true, SceneAntialiasing.BALANCED);primaryStage.setScene(场景);primaryStage.show();}

问题不在于相机,而在于抗锯齿.

Mac 上的解决方法:使用 SceneAntialiasing.DISABLED.这将照常工作,您将能够添加 3D 对象.

My app with javafx 3D objects was working fine until I upgraded java from 8u51 to 8u60. After the upgrade, the UI is displayed upside down. Here is what I get with the following test code. It seems the y axis is reversed in rendering but not in functionality.

I have tried to put -Dprism.order=sw as a VM option. This fixes the test problem, but then does not allow javafx 3D objects to be rendered.

Does anyone knows how to fix this java/javafx issue. I will try to download and install Java 8u51.

Note, I have read JavaFX Mac OS strange rendering .

import javafx.application.Application;
import javafx.scene.PerspectiveCamera;
import javafx.scene.SceneAntialiasing;
import javafx.scene.control.*;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.scene.Scene;

public class TestAppj extends Application {
    public static void main(String[] args) {  Application.launch(args); }
        public void start(Stage primaryStage) {
            primaryStage.setTitle("Test Stage");
            TabPane tabbedPane = new TabPane(new Tab("Tools", new BorderPane()), new Tab("Things", new BorderPane()));
            MenuBar menuBar = new MenuBar(
                    new Menu("File", null, new MenuItem("Open"), new     MenuItem("New"), new MenuItem("Save")),
                new Menu("Edit", null, new MenuItem("Cut"), new MenuItem("Copy"),   new MenuItem("Paste")));
          BorderPane root = new BorderPane();
        root.setTop(new VBox(menuBar, new ToolBar()));
        root.setCenter(tabbedPane);
        Scene theScene = new Scene(root, 500, 500, true, SceneAntialiasing.BALANCED);
        theScene.setCamera(new PerspectiveCamera());
        primaryStage.setScene(theScene);
        primaryStage.show();
    }
}

解决方案

This is a shorter way to reproduce the bug you have found with 8u60 on Mac:

@Override
public void start(Stage primaryStage) {
    Scene scene = new Scene(new StackPane(new Label("Antialising
Balanced")), 
            300, 300, true, SceneAntialiasing.BALANCED);
    primaryStage.setScene(scene);
    primaryStage.show();
}

The problem is not in the camera, but just in the antialiasing.

Workaround for now on Mac: use SceneAntialiasing.DISABLED. That will work as usual and you will be able to add 3D objects.

这篇关于Java 升级后 OSX 上的 JavaFX 渲染问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆