title: Basic Multiply and Divide Java GUI
body: <p>I am trying to have the number the user inputs into the frame either multiply by 2 or divide by 3 depending on which button they decide to click. I am having an hard time with working out the logic to do this. I know this needs to take place in the actionperformed method.</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  
  
  public class Quiz4 extends JFrame ActionListener
  {
  
   // Global Variable Declarations
   // Our list input fields
   private JLabel valueLabel = new JLabel("Enter a value between 1 and 20: ");
   private JTextField valueField = new JTextField(25);
  
   // create action buttons
   private JButton multiButton = new JButton("x2");
   private JButton divideButton = new JButton("/3");
  
   private JScrollPane displayScrollPane;
   private JTextArea display = new JTextArea(10,5);
  
  // input number
  private BufferedReader infirst;
  // output number
  private NumberWriter outNum;
  
   public Quiz4()
  {
       //super("List Difference Tool");
       getContentPane().setLayout( new BorderLayout() );
  
       // create our input panel
       JPanel inputPanel = new JPanel(new GridLayout(1,1));
       inputPanel.add(valueLabel);
       inputPanel.add(valueField);
  
       getContentPane().add(inputPanel,"Center");
  
       // create and populate our diffPanel
       JPanel diffPanel = new JPanel(new GridLayout(1,2,1,1));
       diffPanel.add(multiButton);
       diffPanel.add(divideButton);
       getContentPane().add(diffPanel, "South");
  
      //diffButton.addActionListener(this);
  
  } // Quiz4()
  
  public void actionPerformed(ActionEvent ae)
  {
  
  } // actionPerformed()
  
  public static void main(String args[])
  {
       Quiz4 f = new Quiz4();
       f.setSize(1200, 200);
       f.setVisible(true);
       f.addWindowListener(new WindowAdapter()
   { // Quit the application
       public void windowClosing(WindowEvent e)
       {
       System.exit(0);
   }
   });
   } // main()
  } // end of class
  </code></pre>