Question: Java compiler error The code: import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.geometry.Pos; import javafx.geometry.Insets; import javafx.scene.control.Label; import javafx.scene.control.Button; /** * * @author
Java compiler error
The code:
import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.geometry.Pos; import javafx.geometry.Insets; import javafx.scene.control.Label; import javafx.scene.control.Button;
/** * * @author */ public class LatinTranslator extends Application { public static void main(String[] args) { // Launch the application. launch(args); } @Override public void start (Stage primaryStage) { // Create the buttons. Button sinisterButton = new Button("Sinister"); Button dexterButton = new Button("Dexter"); Button mediumButton = new Button ("Medium"); //Create the output label. Label outputLabel = newLabel(); // Register event handlers for the buttons. sinisterButton.setOnAction (e -> { outputLabel.setText("Left"); }); dexterButton.setOnAction(e -> { outputLabel.setText("Right"); }); mediumButton.setOnAction(e -> { outputLabel.setText("Center"); }); // Put the controls in a VBox. VBox vbox = new VBox(10, sinisterButton, dexterButton, mediumButton, outputLabel); // Set the VBox's alignment to center. vbox.setAlignment(Pos.CENTER); // Set the VBox's padding to 10 pixels. vbox.setPadding(new Insets(10)); // Add the VBox to a new scene. Scene scene = new Scene(vbox); // Set the scene to the stage and display it. primaryStage.setScene(scene); primaryStage.show(); } }
error: cannot find symbol Label outputLabel = newLabel(); symbol: method newLabel() location: class LatinTranslator 1 error BUILD FAILED (total time: 1 second)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
