JavaFX coordinate system defaults to YUp

[亡魂溺海] 提交于 2020-01-05 05:50:15

问题


In my JavaFX Application, I use SceneBuilder by Gluon. The preview for the scene has a coordinate system of Y Down (Y increases downwards). However, when I import the fxml file into Java, the coordinates are all flipped. Here are the relevant screenshots.

Here is the Java export: And here is the SceneBuilder preview:

From what I have gathered from extensive Googling, the JavaFX coordinate system should be Y-Down, not Y-Up. Is there something wrong with my version of JavaFX? I'm on Mac OS X 10.12 (El Capitan), using JDK 1.8.0_66.


回答1:


The default orientation in JavaFX is definitely y-down and there is no difference between SceneBuilder and any other JavaFX application. Of course you can apply a transform which changes this orientation but the default is as expected. Without seeing your fxml it is impossible to tell what is going on here. My guess would be that there is a difference in the containers into which your fxml is loaded. The visual difference may then be caused by different layout behaviours of these containers.



来源:https://stackoverflow.com/questions/38362498/javafx-coordinate-system-defaults-to-yup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!