JavaFX coordinate system defaults to YUp

2019-07-31 19: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: Java application And here is the SceneBuilder preview: 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条回答
不美不萌又怎样
2楼-- · 2019-07-31 19:31

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.

查看更多
登录 后发表回答