Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My JavaFX code is not working. I am taking an error which is attached in the screenshot. The code I use is down below.I need

My JavaFX code is not working. I am taking an error which is attached in the screenshot. The code I use is down below.I need help for fixing it all.

package application;

import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.scene.layout.StackPane; import javafx.stage.Stage;

public class PayableInterfaceTest extends Application { private TextField firstNameField; private TextField lastNameField; private TextField ssnField; private TextField grossSalesField; private TextField commisionRateField; private TextField baseSalaryField; private String firstName; private String lastName; private String socialSecurityNumber; private double grossSales; private double commisionRate; private double baseSalary; public PayableInterfaceTest(String firstName, String lastName, String socialSecurityNumber, double grossSales, double commisionRate, double baseSalary) { // assign values this.firstName = firstName; this.lastName = lastName; this.socialSecurityNumber = socialSecurityNumber; this.grossSales = grossSales; this.commisionRate = commisionRate; this.baseSalary = baseSalary; } @Override public void start(Stage primaryStage) { StackPane root = new StackPane(); Label firstNameLabel = new Label("First Name:"); root.getChildren().add(firstNameLabel); Label lastNameLabel = new Label("Last Name:"); root.getChildren().add(lastNameLabel); Label ssnLabel = new Label("Social Security Number:"); root.getChildren().add(ssnLabel); Label grossSalesLabel = new Label("Gross Sales:"); root.getChildren().add(grossSalesLabel); Label commisionRateLabel = new Label("Commission Rate:"); root.getChildren().add(commisionRateLabel); Label baseSalaryLabel = new Label("Base Salary:"); root.getChildren().add(baseSalaryLabel); Scene scene = new Scene(root, 600, 400); primaryStage.setTitle("Payable Interface Test"); primaryStage.setScene(scene); primaryStage.show(); firstNameField = new TextField(); lastNameField = new TextField(); ssnField = new TextField(); grossSalesField = new TextField(); commisionRateField = new TextField(); baseSalaryField = new TextField();

firstNameField.setText(firstName); lastNameField.setText(lastName); ssnField.setText(socialSecurityNumber); grossSalesField.setText(String.valueOf(grossSales)); commisionRateField.setText(String.valueOf(commisionRate)); baseSalaryField.setText(String.valueOf(baseSalary)); Button calcButton = new Button("Calculate Earnings"); Button exitButton = new Button("Exit"); calcButton.setOnAction(new CalcButtonHandler()); exitButton.setOnAction(new ExitButtonHandler());

GridPane gridPane = new GridPane(); gridPane.setPadding(new Insets(10)); gridPane.getHgap(); } }

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions