import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Week02 { private JFrame frame; private JTextField textFieldA; private JTextField textFieldB; private JTextField textFieldC; private JTextField textFieldD; private JButton btnNewButton; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Week02 window = new Week02(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public Week02() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 546, 412); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); textFieldA = new JTextField(); textFieldA.setBounds(30, 31, 173, 53); frame.getContentPane().add(textFieldA); textFieldA.setColumns(10); textFieldB = new JTextField(); textFieldB.setBounds(30, 119, 173, 53); frame.getContentPane().add(textFieldB); textFieldB.setColumns(10); textFieldC = new JTextField(); textFieldC.setBounds(30, 206, 173, 58); frame.getContentPane().add(textFieldC); textFieldC.setColumns(10); textFieldD = new JTextField(); textFieldD.setEditable(false); textFieldD.setBounds(30, 288, 173, 53); frame.getContentPane().add(textFieldD); textFieldD.setColumns(10); JButton compute = new JButton("Compute"); compute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String Input; double textFieldA; double textFieldB; double textFieldC; double textFieldD; double Add; double Multiply; double Divide; double Subtract; if (textFieldC == Add) { double a, b, c; a = Double.parseDouble(Input); b = Double.parseDouble(Input); c = a + b; textFieldD (+ c); //how do we send the answer to textFieldD???? this method isn't working } } }); compute.setBounds(233, 224, 139, 29); frame.getContentPane().add(compute); btnNewButton = new JButton("Instructions"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JOptionPane.showMessageDialog(null, "All possable imputs \n" + "Add \n" + "Subtract \n" + "Multiply \n" + "Divide \n"); } }); btnNewButton.setBounds(382, 224, 123, 29); frame.getContentPane().add(btnNewButton); } }