Home /
Expert Answers /
Computer Science /
code-in-java-the-code-below-creates-a-gui-as-shown-in-the-figure-below-you-must-write-the-ac-pa155
(Solved): code in Java
The code below creates a GUI, as shown in the figure below. You must write the ac ...
code in Java
The code below creates a GUI, as shown in the figure below. You must write the actionPerformed() method for this GUI. Page 4 of 8 When the user clicks either the Plus or Minus buttons, the text field on the right (Ans) is filled with the answer to calculation as specified by the other two text fields and the choice of the button. The figure above shows a particular example of this. The code for the constructor has also been omitted as it is not necessary for your answer. Do not write the constructor. import java.awt.*; import java.awt.event.*; import javax.swing. *; public class Q extends JFrame implements ActionListener\{ JButton Plus, Minus; JTextField Left, Right, Ans; JPanel ButtonPanel, AllPanel; JLabel Equals; public static void main(String[] args) \{ // Create an object Qf= new Q(); //Make the object visible f.setVisible(true); \} Q(){ \} //Omitted // YOUR ACTIONPERFORMED METHOD WILL GO HERE \}