Please provide the TipCaculatorController codebased on the following TipCalculator main class andTipCalculator.fxml code.
Use JavaFX and scenebuilder.
TipCalculator.java
package application;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.fxml.FXMLLoader;
public class TipCalculator extends Application {
@Override
public void start(Stage primaryStage) {
try {
GridPane root =(GridPane)FXMLLoader.load(getClass().getResource(“TipCalculator.fxml”));
Scene scene =new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource(“application.css”).toExternalForm());
primaryStage.setScene(scene); //attach scene to stage
primaryStage.show(); //display the stage
} catch(Exception e) {
e.printStackTrace();
}
public static void main(String[] args) {
launch(args);
}
}
TipCalculator.fxml
<?xml version=”1.0″ encoding=”UTF-8″?>
<?importcom.gluonhq.charm.glisten.control.AutoCompleteTextField?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Slider?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<GridPane alignment=”TOP_LEFT” hgap=”8.0″ vgap=”0.0″xmlns:fx=”http://javafx.com/fxml/1″fx:controller=”application.TipCalculatorController”>
<children>
<Label text=”Purchase Amount” textAlignment=”RIGHT”GridPane.columnIndex=”0″ GridPane.rowIndex=”0″ />
<Label text=”15%” textAlignment=”RIGHT” GridPane.rowIndex=”2″/>
<Label fx_id=”tipPercentageLabel”
PayPal Gateway not configured
PayPal Gateway not configured