JavaFX scene builder 2: controller class

寵の児 提交于 2019-12-17 23:38:29

问题


Hi im building a JavaFX project and am using JavaFX Scene Builder 2. I wanted to link my controller to my fxml file but i can't see the possibility to add a controller to my fxml file in Scene Builder 2. I was wondering if someone could help me out. Thank you.


回答1:


As you see on the image the controller menu moved on the left , below the Library List.




回答2:


I found the controller attributes by accident in SceneBuilder 2. When closing the hierarchy menu on the left side the Controller menu will be visible where I can declare my controller




回答3:


Update

This answer is obsolete. The solution is to use Gluon SceneBuilder and set the controller as specified in the screenshot provided in the most upvoted answer to this question.


I HIGHLY recommend using Scene Builder 1.1 until Scene Builder 2 becomes more complete and reliable a few months from now.

When I recently used Scene Builder 2, it was still an unreliable, early access release.

Scene Builder 1.1 has a feature in the right hand code panel where you can set the controller class. Scene Builder 2 does not seem to have this feature. Therefore, if you use SceneBuilder 2, you will need to set the controller class manually as xxlali says. If, as you indicate, Scene Builder 2 early access sometimes removes your manually set controller class from the FXML file, then that would be one more reason to use a stable certified version rather than the immature early access version.



来源:https://stackoverflow.com/questions/21060568/javafx-scene-builder-2-controller-class

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