This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 236822 - Make Controller for fx:root
Summary: Make Controller for fx:root
Status: NEW
Alias: None
Product: javafx
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.0
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2013-10-07 08:15 UTC by maxnitribitt
Modified: 2014-07-18 07:12 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description maxnitribitt 2013-10-07 08:15:31 UTC
The 'Make Controller' Context Menu Action creates a Controller from an FXML-File. This works partially (Initializable is deprecated) for FXML-Files with a declared Controller. 

In case the Root Element of the FXML-File is fx:root the generated Controller won't work.

1. The generated Controller needs to be of the type declared as an Attribute in the fx:root Element.
2. The Wizard adds a fx:controller Attribute to the fx:root Element, which it shouldn't.
Comment 1 Roman Svitanic 2013-10-09 13:21:04 UTC
"Make Controller" works for me OK, even with fx:root as FXML root element.

Tested on:
Product Version: NetBeans IDE Dev (Build 201310090001)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b56

fx:controller must be specified even when FXML root element is fx:root. Otherwise it won't be possible to run the application.

If you think that something is wrong, please provide exact steps how to reproduce the problem and reopen the issue. Thanks!
Comment 2 Roman Svitanic 2013-10-09 13:38:24 UTC
Which version of IDE have you been using?

If it was 7.4 RC2 or older Dev versions, then it could be caused by fxml namespace issue which has been fixed and fix is present in trunk (so in current dev builds). It's targeted for release in the next NetBeans release.
Comment 3 maxnitribitt 2013-10-09 16:26:53 UTC
Product Version: NetBeans IDE Dev (Build 201310070001)

The whole point for fx:root is that we can provide the Controller on FXMLLoader instead of defining in FXML. Try this Tutorial:

You can download the NB Project here:

There's no controller defined in the FXML, and it's still possible to run the application.
Comment 4 Svata Dedic 2014-07-18 07:12:18 UTC
Hm, with only type attribute, I am perhaps able to generate the Controller file, but won't be able to update the controller file afterwards. Maybe only if the controller class is the only of the type in the fxml package... weird.