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.
Summary: | Generated controller file is in JavaFX 2 format rather than JavaFX 8 format | ||
---|---|---|---|
Product: | javafx | Reporter: | omniprof |
Component: | Project | Assignee: | Roman Svitanic <rsvitanic> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.1 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
omniprof
2014-11-25 15:21:46 UTC
Here is what I believe the controller should look like for JavaFX 8: // package statement here import java.util.ResourceBundle; import javafx.fxml.FXML; /** * FXML Controller class * * @author */ public class ExampleController{ // Change the pane type if you change the FXML @FXML private AnchorPane thisLayout; @FXML private ResourceBundle rb; /** * Initializes the controller class. */ @FXML public void initialize() { // TODO } } While there may not be a need to have a variable for the AnchorPane it is good practice to have one. The comment remids the programmer to change the pane type if they choose to use another pane such as BorderPane. While reviewing the plugins for NetBeans I discovered the the JavaFX plugin is just for version 2. Therefore my issue is likely to resolved once a version 8 plugin is released. Could you give me a time frame for this upgrade? What the Reporter has suggested is not specific to JavaFX 8. It's JavaFX 2.2. In JavaFX 2.1 and earlier, a controller class was required to implement the Initializable interface so it could be notified when the related FXML document had been completely loaded. This is no longer necessary since JavaFX 2.2., because FXMLLoader will now automatically call any suitably annotated no-arg initialize() method defined by the controller. See https://docs.oracle.com/javafx/2/api/javafx/fxml/Initializable.html I would recommend the change suggested in this issue's Description. I don't believe it is a requirement (?) for NetBeans IDE to support JavaFX versions 2.1 and older. The other changes suggested in Comment #1 are nice-to-haves... However, because the JavaFX 2 plugin would continue to support JavaFX 2.2/JDK 7, I would NOT change the NAME of the plugin (JavaFX 2). Changing Issue Type to Enhancement, because current implementation doesn't break code - it doesn't even cause warnings during a build AFAICT. |