Given the GUI example below as well as the starter code, complete it by adding a JTextField, a JButton, and a JTextArea. When the user enters a String to the JTextField and click the button, the JTextArea should display corresponding output on a new line per button press. You also need to write code for the cleanDuplicates() method. Please do not change the method header of this method. You can define any additional helper methods you need. You must use recursion for this method. For the GUI layout, use the default FlowLayout for the JPanel. The width and height of the JFrame is 450 and 275 pixels, respectively. The JTextField should be 15 columns long. The JTextArea should be of 10 rows and 30 columns. Do not forget to inherit JFrame for this class. JTextField with 15 columns JButton Final Exam Program х Clean Duplicates JTextArea with 10 rows and 30 columns
JTextArea with 10 rows and 30 columns public class GUI{ public GUI() { } /** * Clean Duplicates String example input: "aasd", "ccaaaaaarrrrr", "cat", """ * Clean Duplicates String example output: "asd", "car", "cat", 1111 * * Do not change the method header. You can implement any additional helper * method as you need. * @param s The String to clean duplicate characters from. * @return A String that has no duplicate characters. */ public static String cleanDuplicates(String s) { } /** * The main method which creates a JFrame object and instantiates it * with our GUI class and also sets the visibility. @param args The input arguments to the program, if any. */ public static void main(String[] args) { } }
Given the GUI example below as well as the starter code, complete it by adding a JTextField, a JButton, and a JTextArea.
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Given the GUI example below as well as the starter code, complete it by adding a JTextField, a JButton, and a JTextArea.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!