In the following program, the text field displays the text typed…
Question Answered step-by-step In the following program, the text field displays the text typed… In the following program, the text field displays the text typed into it, but when we press the button submit, nothing happens. You should change the given program such that when you enter a text in the text field and press enter, that text is printed out to screen as shown below: import java.awt.*; import javax.swing.*;public class testExample extends JFrame { JTextField textField1; JButton mybutton;public testExample() { setSize(300, 100);setTitle(“Text Action”); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout());textField1 = new JTextField(10); mybutton = new JButton(“Submit”); add(textField1); add(mybutton);setVisible(true); }public static void main(String args[]) {new testExample(); }} 5. a. What does the part implements ActionListener in the class header do?b. What does the statement convertButton.addActionListener(this); do? c. What does the statement inputField.addActionListener(this); do?d. What does the method actionPerformed(ActionEvent ae) do?e. What does the statement Object o = ae.getSource(); do? 6. Computer Science Engineering & Technology Java Programming MIS 3330 Share QuestionEmailCopy link Comments (0)


