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 Graphical User Interfaces Adding an Event Handler

Jarvis Chandler
Jarvis Chandler
7,619 Points

Building a buttonb?

This code seems to be right but it well not let me pass?

com/example/Home.java
package com.example;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;

public class Home extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        Group root = new Group();
        Button playButton = new Button();
       btn.setText("Playing!");
      bn.setOnAction(evt -> System.out.printf("Playing"));

        root.getChildren().add(playButton);
        primaryStage.setTitle("Boombox");
        primaryStage.setScene(new Scene(root, 300, 275));
        primaryStage.show();
    }


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

1 Answer