IntelliJ and SceneBuilder code sync

        Hi everyone.

I am new to Java and IntelliJ. I'm testing forms with JavaFX and SceneBuilder.
I created a "test form", it show all right.

My question is, when I drop a new control in SceneBuilder, affect it a "name" (fx:id),
why doesn't my controller code it IntelliJ doesn't gets updated ? (the class)

I'm trying to add a simple checkbox.

here is the code of my controller class :
package sample :

import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.input.MouseEvent;

public class Controller {

    private ResourceBundle resources;

    private URL location;

    private Button MyButton;

    private TextArea MyText;

    void MyButtonClick(MouseEvent event)
        MyText.appendText("coucou \n");

    void initialize() {
        assert MyButton != null : "fx:id=\"MyButton\" was not injected: check your FXML file 'sample.fxml'.";
        assert MyText != null : "fx:id=\"MyText\" was not injected: check your FXML file 'sample.fxml'.";



Eric Walker

1 comment
Comment actions Permalink

Hi Eric,

IDEA does sync with .fxml after SceneBuilder changes but it doesn't perform any inflected refactorings.

Another example: suppose one has given a new name for a field, push the code and you expect IDEA that it would perform the rename when getting updated from VC. It doesn't look fair to me: whether you use SceneBUilder for renaming and expect it to perform the refactoring or you use IDEA and it would rename controller parts also over .fxml.



Please sign in to leave a comment.