Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java JGrasp (JavaFX) Assignment You will modify the SudokuCheckApplication program that is listed below. Create a class that will take string input and process it
Java JGrasp (JavaFX) Assignment
- You will modify the SudokuCheckApplication program that is listed below.
- Create a class that will take string input and process it as a multidimensional array
- You will modify the program to use a multi-dimensional array to check the input text.
SudokuCheckApplication.java
import javafx.application.*; import javafx.event.*; import javafx.geometry.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.*; public class SudokuCheckApplication extends Application { public void start(Stage primaryStage) { // Create addressable controls // Reachable from the event handlers TextArea taInput = new TextArea("Input your Sudoku answer here:"); TextArea taOutput = new TextArea("The results will display here:"); // Create the GridPane pane GridPane pane = new GridPane(); pane.setPadding(new Insets(10, 10, 10, 10)); pane.setVgap(5); // Place nodes in the GridPane pane pane.add(new Label("Input Sudoku:"), 0, 0); pane.add(taInput, 0, 1); // Create FlowPane pane FlowPane btnPane = new FlowPane(); btnPane.setAlignment(Pos.CENTER); pane.setHgap(5); // Place nodes in the FlowPane pane and place // pane in the GridPane pane btnPane.setPadding(new Insets(10, 10, 10, 10)); btnPane.setHgap(10); // Create buttons and event handlers // Check Button Button btnCheck = new Button("Check"); btnCheck.setOnAction(new EventHandler() { public void handle(ActionEvent e) { // take the text from taInput.getText() and use a multidimentional array to process the data // Output the result to taOutput.setText("the output string here"); } }); // Clear Button Button btnClear = new Button("Clear"); btnClear.setOnAction(new EventHandler() { public void handle(ActionEvent e) { taInput.setText(""); taOutput.setText(""); } }); // Place Buttons on the FlowPane and place FlowPane on GridPane btnPane.getChildren().addAll(btnCheck, btnClear); pane.add(btnPane, 0, 2); // Place nodes in the GridPane pane pane.add(new Label("Check result:"), 0, 3); pane.add(taOutput, 0, 4); //Create scene and place it on the stage Scene scene = new Scene(pane); primaryStage.setTitle("CPT 237 Sudoku Checker"); primaryStage.setScene(scene); primaryStage.show(); } /** * The main method is only needed for the IDE with limited * JavaFX support. Not needed for running from the command line. */ public static void main(String[] args) { launch(args); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started