JavaFx, Problems with @FXML

Your problem is in import in Controller class:

import java.awt.*;

Should be:

import javafx.scene.control.TextField;

The programs tries to convert java.awt.TextField to javafx.scene.control.TextField

I assume you’d like to use javafx, not AWT TextField

Note: don’t trust the imports which IDE gives you 🙂

Leave a Comment