jan behang
jan behang

Reputation: 535

JavaFX scene builder 2: controller class

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.

Upvotes: 32

Views: 37393

Answers (3)

jewelsea
jewelsea

Reputation: 159341

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.

Upvotes: 1

Muhamet Aljobairi
Muhamet Aljobairi

Reputation: 1638

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

Upvotes: 80

jan behang
jan behang

Reputation: 535

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

Upvotes: 22

Related Questions