Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

Chance Edward
Chance Edward
4,507 Points

Whats wrong with my code? For some reason it can't resolve FMXLLOADER and Stage.

<p>Some HTML Code</p>

package sample.sup;

import javafx.application.Application; import javafx.fxml.FXMLLOADER; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.Stage; import javafx.scene.Group; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.stage.Stage; import javafx.scene.text.Text;

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");
    txt.setFont(new Font("Bernard MT Condensed", 80));
    Label  label = new Label("Name:");
    TextField nameFld = new TextField();
    GridPane grid = new GridPane();
    grid.add(label, 0, 0);
    grid.add(nameFld, 1, 0);
    grid.setHgap(20);
    Button btn = new Button();
    grid.add(btn, 1, 1);
    //grid.setGridLinesVisible(true);
    btn.setText("Say Sup");
    btn.setOnAction(evt -> System.out.printf("Sup %s!%n",
           nameFld.getText()));
    txt.setY(50);
    VBox box = new VBox();
    box.getChildren().addAll(txt, grid);
    root.getChildren().add(box);*/
    primaryStage.setTitle("Sup");
    primaryStage.setScene(new Scene(root, 300, 275));
    primaryStage.show();

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

}