new FXML file for JavaFX with the corresponding controller

would be great to have a basic template of a new File with a new empty FXML with its respective controller:

like netbeans does:


Comment actions Permalink

Hi Sebastian,
it's planed to add create .fxml from usage: suppose you have includ tag and non-existing .fxml or have java code which references unresolved .fxml => intention would suggest to create corresponding .fxml. Create controller from usage in .fxml already exist. If you start from JavaFX Application you get these files generated. Too many templates - too many actions to choose from, I am afraid that most users won't find the action and still it would pollute the menu: so my question is would you need this generation if create from usage would be complete?

Comment actions Permalink

I think is really important to have as we have a File->New (Java File, HTML.....) have a new FXML, for speed porpoises of making javafx apps, if you look netbeans yo add a new FXML and it adds you a basic template of an FXML file with the controller that corresponds to that FXML, we've been doind a lot of javafx and this is a really MUST for us to have this access to create new FXML with their respective "code behind".


New-> FXML and I put the name FXML.fxml

it creates


<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns:fx="" fx:controller="javafxapplication.FXMLController">



package javafxapplication;

import java.util.ResourceBundle;
import javafx.fxml.Initializable;

* FXML Controller class
* @author Sebastian
public class FXMLController implements Initializable {

     * Initializes the controller class.
    public void initialize(URL url, ResourceBundle rb) {
        // TODO

and that's it whit this we have a very basic but usable start for creating javafx apps.
Comment actions Permalink

You may setup your own template in File|Settings|File and Code Templates => new action to create .fxml would appear in New menu. You may use $Name$ inside template (to compose e.g. controller name) it would be substituted with inserted .fxml name. Then alt + enter on unexisting class would give you a sample controller.
You may create an issue in youtrack ( and we'll see how many votes it would get.


Please sign in to leave a comment.