Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Build a JavaFX Application Design a Better App Separating the Layout

FXML file doesn't support 'controller'

Hello, I'm using a different IDE (Netbeans) than what the tutorial is using. My IDE is stating " Class 'javafx.scene.layout.GridPane' does not support property 'controller' ". How can I fix this before I move forward in the lesson?

<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<GridPane fx:controller="sample.Controller"
    xmlns:fx="http//javafx.com/fxml" alignment="center" hgap="10" vgap="10">
</GridPane>

Please note: I didn't auto generate this. I created it by hand.

1 Answer

Gavin Ralston
Gavin Ralston
28,770 Points
 xmlns:fx="http//javafx.com/fxml" alignment="center" hgap="10" vgap="10">

Try correcting the URI in that line to include the necessary colon:

 xmlns:fx="http://javafx.com/fxml"

See if that helps.