
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Please help I am having trouble with my gui for my encryption and decryption java code
The encryption and decryption java code is below and the gui file is in the photos
import java.util.*;
public class Main
{
public static boolean isALetter(char letter){
if( (letter >= 'a' && letter = 'A' && letter =-32767 && encryptKey

Transcribed Image Text:GUI.java B
1 import java.awt.*;
2 import javax.swing. *;
3 import java.awt.event. *;
4
5
class Main extends JFrame implements ActionListener {
6
7
JButton btnClear, btnEn, btnDe;
8 JTextField txtIn, txtOut;
JLabel lblEn, lblDe;
9
10
11 ▼
public Main () {
12
13
super("Super Spy Encryption");
14
15
16
btnClear = new JButton("Clear");
btnEn = new JButton("Encrypt");
btnDe= new JButton("Decrypt");
17
18
19
20
btnClear. addActionListener(this);
btnEn. addActionListener(this);
btnDe.
21
ionListener(this);
22
23
txtIn= new JTextField (50);
24
txtOut= new JTextField(50);
25
26
lblEn= new JLabel("Type your message to Encrypt here");
lblDe= new JLabel("Type your message to Decrypt here");
27
28
29
set Layout(new GridLayout(7,1));
30
add (lblen);
31
add (txtIn);
32
add (lblDe);
33
add (txtOut);
34
add (btnEn);
35
add (btnDe);
36
add (btnClear);
37
38
setSize(300, 300);
39
setVisible(true);
40
41
} // Constructor
42
public void action Performed (ActionEvent e)
43 ▼
{
44 // check which button was clicked
45 if (e.getSource () == btnDe)
![46 ▼ {
47 // declare strings for input and output
48 String phraseIn, phraseOut;
49 phraseIn = txtIn.getText (); // get the input string
50 phraseOut = phraseIn.reverse();
51 txtOut.setText (phraseOut);
52 }
==
btnClear)
53 else if (e.getSource ()
54▼ {
55 txtIn.setText (""); // clear both strings
56 txtOut.setText ("");
57
58
}
59
}
60
public static void main(String[] args)
61 ▼
{
62
new Main();
63
}
64 }](https://content.bartleby.com/qna-images/question/1e5fac3f-b4d1-46c0-9391-ffd578d177ae/4cd62521-545e-40d2-9293-459b3479bbea/ivs8gee_thumbnail.jpeg)
Transcribed Image Text:46 ▼ {
47 // declare strings for input and output
48 String phraseIn, phraseOut;
49 phraseIn = txtIn.getText (); // get the input string
50 phraseOut = phraseIn.reverse();
51 txtOut.setText (phraseOut);
52 }
==
btnClear)
53 else if (e.getSource ()
54▼ {
55 txtIn.setText (""); // clear both strings
56 txtOut.setText ("");
57
58
}
59
}
60
public static void main(String[] args)
61 ▼
{
62
new Main();
63
}
64 }
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps

Knowledge Booster
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
- Please create a flowchart for the following program: // Import Scanner classimport java.util.Scanner; // Create a class Trianglepublic class Main{ // Method used to check given three sides form a valid triangle or not public static boolean isTriangle(double a, double b, double c) { // If sum of any two sides is greater than third side if((a+b > c) && (a+c > b) && (b+c > a)) { // Print triangle is valid System.out.println("Three sides form a valid triangle."); // Return true return true; } // If any of the above condition is false else {// Print triangle is invalidSystem.out.println("Three sides form a invalid triangle.\n"); // Return false return false; } } // Method used to compute the area of triangle public static double triArea(double a, double b, double c) { // Compute s double s = (a + b + c) / 2; // Compute the area of triangle double area = Math.sqrt(s*(s - a)*(s - b)*(s - c)); // Return the…arrow_forwardJAVA CODE: check outputarrow_forwardFix all errors to make the code compile and complete. //MainValidatorA3 public class MainA3 { public static void main(String[] args) { System.out.println("Welcome to the Validation Tester application"); // Int Test System.out.println("Int Test"); ValidatorNumeric intValidator = new ValidatorNumeric("Enter an integer between -100 and 100: ", -100, 100); int num = intValidator.getIntWithinRange(); System.out.println("You entered: " + num + "\n"); // Double Test System.out.println("Double Test"); ValidatorNumeric doubleValidator = new ValidatorNumeric("Enter a double value: "); double dbl = doubleValidator.getDoubleWithinRange(); System.out.println("You entered: " + dbl + "\n"); // Required String Test System.out.println("Required String Test:"); ValidatorString stringValidator = new ValidatorString("Enter a required string: "); String requiredString =…arrow_forward
- Please help me with the errors I am e having the program below. There are two parts of the program. One is an encryption and decryption java code and the other is the gui for that program Encryption and decryption java code is below import java.util.*; public class Main { public static boolean isALetter(char letter){ if( (letter >= 'a' && letter = 'A' && letter =-32767 && encryptKeyarrow_forwardJava Question- Convert this source code into a GUI application using JOptionPane. Make sure the output looks similar to the following picture. Thank you. import java.util.Calendar;import java.util.TimeZone;public class lab11_5{public static void main(String[] args){//menuSystem.out.println("-----------------");System.out.println("(A)laska Time");System.out.println("(C)entral Time");System.out.println("(E)astern Time");System.out.println("(H)awaii Time");System.out.println("(M)ountain Time");System.out.println("(P)acific Time");System.out.println("-----------------"); System.out.print("Enter the time zone option [A-P]: "); //inputString tz = System.console().readLine();tz = tz.toUpperCase(); //change to uppercase //get current date and timeCalendar cal = Calendar.getInstance();TimeZone.setDefault(TimeZone.getTimeZone("GMT"));System.out.println("GMT/UTC:\t" + cal.getTime()); switch (tz){case "A":tz =…arrow_forwardGiven an integer, return the sum of all the odd numbers starting from 1. Assume the input will always be greater than 2. Ex: If the input is: 20 the output is 1+3+5+7+9+11+13+15+17+19: 100 449182.3196742.qx3zqy7 LAB ACTIVITY 1 import java.util.Scanner; 3 public class LabProgram { 4 5 6 7 8 9 10 13.3.1: CodingBird (Loop): Sum Even public static void main(String[] args) { /* Type your code here. */ } LabProgram.java 0/10 Load default template...arrow_forward
- Q: What's a better way to write this? (C#) public string SomeMethod(string OriginalZip) { string zip = "Zip Not Available"; zip = GetZip(zip, OriginalZip); return zip; } private static string GetZip(string zip, string OriginalZip) { int zipLength = (OriginalZip.HasValue) ? OriginalZip.Value.ToString().Length: 0; int NumOf Leading Zeroes = (zipLength > O && zipLength < 5) ? 5 - zipLength: 0; if (OriginalZip.HasValue) { i++) } zip = OriginalZip.Value.ToString(); for (int i = 0; i < NumOf Leading Zeroes; { } zip = "0" + zip; } return zip;arrow_forwardpublic class Test { } public static void main(String[] args){ int a = 10; System.out.println(a*a--); }arrow_forward.cengage.com/static/nb/ui/evo/index.html?deploymentid=5745321109590169 CENGAGE MINDTAP L01-Understanding Java Utilities U E Book al 5 Compiling and Executing a Java Program Summary In this lab, you compile and execute a prewritten Java program. Instructions 1. Execute the program. There should be no syntax errors. 2. Modify the program so it displays "I'm learning how to program in Java.". Execute the program. 3. Modify the Programming class so it prints two lines of output. Change the class name to Awesome. In Java, the file name must match the class name, so change the file name to Awesome.java. Add a second output statement that displays "That's awesome!". Execute the program. Grading When you have completed your program, click the Submit button to record your score. Program 1 'j 2 pub 12345678 3 { 7}arrow_forward
- Java - Smallest Numberarrow_forward8) Now use the Rectangle class to complete the following tasks: - Create another object of the Rectangle class named box2 with a width of 100 and height of 50. Note that we are not specifying the x and y position for this Rectangle object. Hint: look at the different constructors) Display the properties of box2 (same as step 7 above). - Call the proper method to move box1 to a new location with x of 20, and y of 20. Call the proper method to change box2's dimension to have a width of 50 and a height of 30. Display the properties of box1 and box2. - Call the proper method to find the smallest intersection of box1 and box2 and store it in reference variable box3. - Calculate and display the area of box3. Hint: call proper methods to get the values of width and height of box3 before calculating the area. Display the properties of box3. 9) Sample output of the program is as follow: Output - 1213 Module2 (run) x run: box1: java.awt. Rectangle [x=10, y=10,width=40,height=30] box2: java.awt.…arrow_forwardBAGEL FILES import javax.swing.JFrame; public class Bagel{//-----------------------------------------------------------------// Creates and displays the controls for a bagel shop.//-----------------------------------------------------------------public static void main (String[] args){JFrame frame = new JFrame ("Bagel Shop");frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new BagelControls()); frame.pack();frame.setVisible(true);}} import java.awt.*;import java.awt.event.*; import javax.swing.*; public class BagelControls extends JPanel{private JComboBox bagelCombo;private JButton calcButton;private JLabel cost;private double bagelCost;public BagelControls(){String[] types = {"Make A Selection...", "Plain","Asiago Cheese", "Cranberry"};bagelCombo = new JComboBox(types);calcButton = new JButton("Calc");cost = new JLabel("Cost = " + bagelCost);setPreferredSize (new Dimension (400,…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education