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 Graphical User Interfaces Getting Started

Cannot find symbol - class Text

Does anybody know whats wrong? :(

import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Group; // Imported (!) import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage;

public class Main extends Application {

@Override
public void start(Stage primaryStage) throws Exception{
    //Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
    Group root = new Group();
    Text txt = new Text("SUP?");
    root.getChildren().add(txt);
    primaryStage.setTitle("SUP");
    primaryStage.setScene(new Scene(root, 300, 275));
    primaryStage.show();
}


public static void main(String[] args) {
    launch(args);
}

}

// And then the error:

Information:Using javac 1.8.0_91 to compile java sources

Error:(16, 9) java: cannot find symbol symbol: class Text location: class sample.Main

1 Answer

OW! I forgot to add - import javafx.scene.text.Text;

Thanks I was getting the same thing!