title: Java GUI Fahrenheit/Celsius Converter with a Button
body: <p>I am a beginner in Java GUI's and for class I need to make a program that converts Fahrenheit to Celsius and vice versa. I wanted to make a GUI program that utilized a button but can't find any posts online that would help me. I am having trouble with the button actually working properly. It converts from Fahrenheit to Celsius just fine, but will not convert Celsius to Fahrenheit. I know there is an obvious error in the logic but I cannot for the life of me figure it out. Any help would be much appreciated.</p>
  
  <pre><code>    import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.text.DecimalFormat;
  
      @SuppressWarnings("serial")
      public class Temperature_Converter extends JFrame{
      private static final double CelsiusTOFarenheit = 9.0 / 5.0;
      private static final double FahrenheitTOCelsius = 5.0 / 9.0;
      private static final int offset = 32;
      private JLabel LFahrenheit, LCelsius; //Labels
      private JTextField TFFahrenheit, TFCelsius; //Text Fields
      private JButton BConvert; //Convert Button
      private ConvertButtonHandler ConvButtonHandler;
  
      public Temperature_Converter() {
      setTitle("Temperature Converter");
      Container pane = getContentPane();
      pane.setLayout(new GridLayout(1,5));
  
      LFahrenheit = new JLabel("Farenheit:", JLabel.CENTER);
          pane.add(LFahrenheit);
      TFFahrenheit = new JTextField();
          pane.add(TFFahrenheit);
      BConvert = new JButton("Convert");
          pane.add(BConvert);
              ConvButtonHandler = new ConvertButtonHandler();
              BConvert.addActionListener(ConvButtonHandler);
      LCelsius = new JLabel("Celsius:", JLabel.CENTER);
          pane.add(LCelsius);
      TFCelsius = new JTextField();
          pane.add(TFCelsius);
  
      setSize(600, 85);
      setVisible(true);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
   private class ConvertButtonHandler implements ActionListener{
          public void actionPerformed(ActionEvent e){
              double celsius = 0, fahrenheit = 0;
  
              DecimalFormat twoDigits = new DecimalFormat("0.00");     
                      celsius = Double.parseDouble(TFCelsius.getText());
                      fahrenheit = Double.parseDouble(TFFahrenheit.getText());
                          celsius = (fahrenheit - offset) * FahrenheitTOCelsius;
                          fahrenheit = celsius * CelsiusTOFarenheit + offset;
                              TFCelsius.setText(" "+ twoDigits.format(celsius));
                              TFFahrenheit.setText(" "+ twoDigits.format(fahrenheit));       
      }
   }
  
  public static void main(String[] args) {
      new Temperature_Converter();
  }
  </code></pre>
  
  <p>}</p>