Objective: -use the JTextField and JButton classes; and -Add event listeners to JButton objects. Procedure: 1. Create a folder named LastName_FirstName (ex. Liam_Jimenez) in your local drive. 2. Create a new project named LabExer7B. Set the project location to your own folder. 3. Add another class named RunCheckerSwapper. 4. Create a program that has two (2) JTextField objects, two (2) JButton objects, and one (1) JLabel object. The first JButton will be used to determine whether the texts in two (2) JTextField objects are the same while the other

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Objective:

-use the JTextField and JButton classes; and

-Add event listeners to JButton objects.

Procedure:

1. Create a folder named LastName_FirstName (ex. Liam_Jimenez) in your local drive.

2. Create a new project named LabExer7B. Set the project location to your own folder.

3. Add another class named RunCheckerSwapper.

4. Create a program that has two (2) JTextField objects, two (2) JButton objects, and one (1) JLabel object. The first JButton will be used to determine whether the texts in two (2) JTextField objects are the same while the other JButton will be used to swap the texts. The JLabel will be used to display the result for the CHECK option. See the following screenshots for the program flow:

 

### Text Comparison and Swapping Program Guide

#### Overview
This guide provides a step-by-step demonstration of how to use a simple text comparison and swapping program. The program features two functionalities: checking if two input texts are the same and swapping the texts between two input fields.

#### Interface Breakdown
The interface consists of:
- Two input text fields where users can enter text.
- A "CHECK" button that compares the texts in the two fields.
- A "SWAP" button that swaps the texts between the two fields.
- An output area that displays the result of the text comparison.

#### Steps and Visuals

**Step 1: Before Clicking the 'CHECK' Button**

- **Screenshot Description**:
  - Two input fields containing the text "DORAEMON".
  - A "CHECK" button next to the first input field.
  - A "SWAP" button next to the second input field.

![Before Clicking the Check Button](image-link-placeholder)

*Figure a: This image shows the user interface before the "CHECK" button is clicked. Both input fields contain identical text ("DORAEMON").*

**Step 2: After Clicking the 'CHECK' Button**

- **Screenshot Description**:
  - The interface remains the same with both input fields containing "DORAEMON".
  - After clicking the "CHECK" button, the program displays the text "SAME" in the output area.

![After Clicking the Check Button](image-link-placeholder)

*Figure b: This image shows the user interface after the "CHECK" button is clicked. Since the texts in both input fields are identical, the program displays "SAME".*

#### Summary
This program is a helpful tool for quickly comparing and swapping text in two input fields. The visual demonstrations (Figures a and b) show how to use the "CHECK" button to verify if the texts are identical, and the program responds by displaying "SAME" when they are.
Transcribed Image Text:### Text Comparison and Swapping Program Guide #### Overview This guide provides a step-by-step demonstration of how to use a simple text comparison and swapping program. The program features two functionalities: checking if two input texts are the same and swapping the texts between two input fields. #### Interface Breakdown The interface consists of: - Two input text fields where users can enter text. - A "CHECK" button that compares the texts in the two fields. - A "SWAP" button that swaps the texts between the two fields. - An output area that displays the result of the text comparison. #### Steps and Visuals **Step 1: Before Clicking the 'CHECK' Button** - **Screenshot Description**: - Two input fields containing the text "DORAEMON". - A "CHECK" button next to the first input field. - A "SWAP" button next to the second input field. ![Before Clicking the Check Button](image-link-placeholder) *Figure a: This image shows the user interface before the "CHECK" button is clicked. Both input fields contain identical text ("DORAEMON").* **Step 2: After Clicking the 'CHECK' Button** - **Screenshot Description**: - The interface remains the same with both input fields containing "DORAEMON". - After clicking the "CHECK" button, the program displays the text "SAME" in the output area. ![After Clicking the Check Button](image-link-placeholder) *Figure b: This image shows the user interface after the "CHECK" button is clicked. Since the texts in both input fields are identical, the program displays "SAME".* #### Summary This program is a helpful tool for quickly comparing and swapping text in two input fields. The visual demonstrations (Figures a and b) show how to use the "CHECK" button to verify if the texts are identical, and the program responds by displaying "SAME" when they are.
**How to Use the Checker and Swapper Tool**

This section explains the use of a simple graphical user interface (GUI) application named "Checker and Swapper." The application allows users to check if two texts are the same or to swap the texts between two input fields. Below is a step-by-step guide to understand the functionality visually and textually:

**c. Before clicking the CHECK button (different texts)**

1. The image shows the GUI of the "Checker and Swapper" tool.
2. There are two text fields and two buttons labeled "CHECK" and "SWAP."
3. The text field at the top contains the text "DORAEMON."
4. The text field at the bottom contains the text "PIKACHU."
5. This state is before clicking the "CHECK" button.

**d. After clicking the CHECK button**

1. After clicking the "CHECK" button, the tool compares the text in the two fields.
2. Since "DORAEMON" and "PIKACHU" are different, the message "NOT THE SAME" is displayed.

**e. Before clicking the SWAP button**

1. The GUI is reset to the initial state with "DORAEMON" in the top field and "PIKACHU" in the bottom field.
2. This state is before clicking the "SWAP" button.

**f. After clicking the SWAP button**

1. After clicking the "SWAP" button, the texts in the two fields are swapped.
2. "PIKACHU" moves to the top field and "DORAEMON" moves to the bottom field.

Using this tool, users can easily check if two texts are identical and swap texts between fields to manipulate data quickly.
Transcribed Image Text:**How to Use the Checker and Swapper Tool** This section explains the use of a simple graphical user interface (GUI) application named "Checker and Swapper." The application allows users to check if two texts are the same or to swap the texts between two input fields. Below is a step-by-step guide to understand the functionality visually and textually: **c. Before clicking the CHECK button (different texts)** 1. The image shows the GUI of the "Checker and Swapper" tool. 2. There are two text fields and two buttons labeled "CHECK" and "SWAP." 3. The text field at the top contains the text "DORAEMON." 4. The text field at the bottom contains the text "PIKACHU." 5. This state is before clicking the "CHECK" button. **d. After clicking the CHECK button** 1. After clicking the "CHECK" button, the tool compares the text in the two fields. 2. Since "DORAEMON" and "PIKACHU" are different, the message "NOT THE SAME" is displayed. **e. Before clicking the SWAP button** 1. The GUI is reset to the initial state with "DORAEMON" in the top field and "PIKACHU" in the bottom field. 2. This state is before clicking the "SWAP" button. **f. After clicking the SWAP button** 1. After clicking the "SWAP" button, the texts in the two fields are swapped. 2. "PIKACHU" moves to the top field and "DORAEMON" moves to the bottom field. Using this tool, users can easily check if two texts are identical and swap texts between fields to manipulate data quickly.
Expert Solution
steps

Step by step

Solved in 6 steps with 5 images

Blurred answer
Knowledge Booster
Hyperlinks
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education