Question: Can someone help me fix my eclipse. I wrote this program and I am trying to run it buy I get an error saying Error:

Can someone help me fix my eclipse. I wrote this program and I am trying to run it buy I get an error saying "Error: JavaFX runtime components are missing, and are required to run this application"

This is what I have coded, If you can run this on your program and show me what the output would help and if you want help me fix my program so that it runs it would be even better. Code:

import javafx.application.Application;

import javafx.scene.Scene;

import javafx.scene.control.Button;

//import javafx.scene.control.Label;

//import javafx.scene.control.TextField;

//import javafx.scene.layout.BorderPane;

import javafx.scene.layout.GridPane;

//import javafx.scene.layout.FlowPane;

//import javafx.scene.layout.Pane;

import javafx.stage.Stage;

//import javafx.geometry.Insets;

import javafx.scene.text.Text;

import javafx.scene.text.Font;

import javafx.scene.text.FontWeight;

import javafx.scene.text.FontPosture;

public class UserInterfaceCalculator extends Application {

public void start(Stage primaryStage) {

// Creating a GridPane

GridPane pane = new GridPane();

// Creating a text that shows (0.0) inside

Text zero = new Text(20,20,"0.0");

zero.setFont(Font.font("Courier", FontWeight.NORMAL, FontPosture.REGULAR,15));

pane.add(zero, 0, 0);

pane.getChildren().add(zero);

// Creating all the buttons

// I created button for each number and added them to the pane by (the number, column, row)

Button number7 = new Button("7");

pane.add(number7, 1, 1);

Button number8 = new Button("8");

pane.add(number8, 2, 1);

Button number9 = new Button("9");

pane.add(number9, 3, 1);

Button divide = new Button("/");

pane.add(divide, 4, 1);

Button number4 = new Button("4");

pane.add(number4, 1, 2);

Button number5 = new Button("5");

pane.add(number5, 2, 2);

Button number6 = new Button("6");

pane.add(number6, 3, 2);

Button multiply = new Button("*");

pane.add(multiply, 4, 2);

Button number1 = new Button("1");

pane.add(number1, 1, 3);

Button number2 = new Button("1");

pane.add(number2, 2, 3);

Button number3 = new Button("3");

pane.add(number3, 3, 3);

Button subtract = new Button("-");

pane.add(subtract, 4, 3);

Button clear = new Button("C");

pane.add(clear, 1, 4);

Button number0 = new Button("0");

pane.add(number0, 2, 4);

Button decimal = new Button(".");

pane.add(decimal, 3, 4);

Button add = new Button("+");

pane.add(add, 4, 4);

Button equals = new Button(" = ");

pane.add(equals, 5, 1);

// Creating a scene

Scene scene = new Scene(pane);

primaryStage.setTitle("GUI Calc");

primaryStage.setScene(scene);

primaryStage.show();

}

public static void main(String[] args) {

launch(args);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!