title: Creating a Push Button that performs a function
body: <p>I ended up simplifying my approach greatly. I just modified the second class file to for the button and got rid of the third entirely. Now both the action button and pressing the return key on the keyboard cause the program to complete the calculation. It really wasn't difficult, just required using the same approach but with a different type of listener.  Thank you!</p>
  
  <pre><code>import javax.swing.JFrame;
  public class Fahrenheit
  {
      public static void main (String[] args)
      {
  
      JFrame frame = new JFrame ("Fahrenheit");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
      FahrenheitPanel panel = new FahrenheitPanel();
  
      frame.getContentPane().add(panel);
      frame.pack();frame.setVisible(true);
  
      }
  }
  
  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  
  
  public class FahrenheitPanel extends JPanel
  {
      private JLabel inputLabel, outputLabel, resultLabel;
      private JTextField fahrenheit;
      private JButton push;
  
      public FahrenheitPanel()
      {
          inputLabel = new JLabel ("Enter Fahrenheit temperature:");
          outputLabel = new JLabel ("Temperature in Celsius: ");
          resultLabel = new JLabel ("---");
          push = new JButton ("Convert");
  
          fahrenheit = new JTextField (5);
          fahrenheit.addActionListener (new TempListener());
          push.addActionListener (new ButtonListener());
  
          add (inputLabel);
          add(fahrenheit);
          add (outputLabel);
          add (resultLabel);
          add (push);
  
          setPreferredSize (new Dimension(300,75));
          setBackground (Color.yellow);
      }
  
  
      private class TempListener implements ActionListener
      {
          public void actionPerformed (ActionEvent event)
          {
              int fahrenheitTemp, celsiusTemp;
  
              String text = fahrenheit.getText();
  
              fahrenheitTemp = Integer.parseInt (text);
              celsiusTemp = (fahrenheitTemp-32) * 5/9;
  
              resultLabel.setText (Integer.toString (celsiusTemp));
            }
        }
  
  
      private class ButtonListener implements ActionListener
      {
          public void actionPerformed (ActionEvent event)
          {
              int fahrenheitTemp, celsiusTemp;
  
              String text = fahrenheit.getText();
  
              fahrenheitTemp = Integer.parseInt (text);
              celsiusTemp = (fahrenheitTemp-32) * 5/9;
  
              resultLabel.setText (Integer.toString (celsiusTemp));           
          }
      }
  }
  </code></pre>