Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Intro to JAVA: Assignment 12 This assignment will focus on the use anonymous inner class handlers to implement event handling. Follow the directions below to

Intro to JAVA: Assignment 12

This assignment will focus on the use anonymous inner class handlers to implement event handling.

Follow the directions below to submit Assignment 12:

1. This assignment will be a modification of the Assignment 11 program (code to be modified included below).

2. This program should use the controls and layouts from the previous assignment. No controls or layouts should be added or removed for this assignment.

3. Add event handlers for the three buttons. The event handlers should be implemented as anonymous inner class handlers.

4. The event handler for the encrypt button should call the encryptString() method in the EncryptString class. The input text should be passed to the encryptString() method and the value returned should be displayed in the output TextArea field.

5. The event handler for the clear button should clear any text in the input TextArea and the output TextArea.

6. The event handler for the decrypt button should call the decryptString() method in the EncryptString class. The input text should be passed to the decryptString() method and the value returned should be displayed in the output TextArea field.

------------------------------------------------------------------------------------------

// This program is a JavaFX program that will // be used as the GUI for this assignments // //*********************************************

import javafx.application.*; import javafx.geometry.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.*;

public class EncryptionApplication11 extends Application {

public void start(Stage primaryStage) { // 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 Text:"), 0, 0); pane.add(new TextArea("Input text here"), 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); btnPane.getChildren().addAll(new Button("Encrypt"), new Button("Clear"), new Button("Decrypt")); pane.add(btnPane, 0, 2); // Place nodes in the GridPane pane pane.add(new Label("Output Text:"), 0, 3); pane.add(new TextArea("Output text here"), 0, 4); //Create scene and place it on the stage Scene scene = new Scene(pane); primaryStage.setTitle("CPT 236 Encryption Application"); 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

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

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions