A good answer might be:

The complete application (suitable for copying and running) is below:

An Application You Can Run

Of course, you will want to copy the following into NotePad, save it to a file, compile and run it.

import java.awt.*; 
import java.awt.event.*;
import javax.swing.* ;
    
public class FahrConvert extends JFrame implements ActionListener
{
  JLabel title    = new JLabel("Convert Fahrenheit to Celsius");
  JLabel inLabel  = new JLabel("Fahrenheit    ");
  JLabel outLabel = new JLabel("Celsius ");
   
  JTextField inFahr = new JTextField( 7 );
  JTextField outCel = new JTextField( 7 );
    
  int fahrTemp ;
  int celsTemp ;
    
  FahrConvert()   
  {  
     getContentPane().setLayout( new FlowLayout() );   
    
     inFahr.addActionListener( this );
     getContentPane().add( title );    
     getContentPane().add( inLabel );  
     getContentPane().add( outLabel ); 
     getContentPane().add( inFahr );   
     getContentPane().add( outCel );   
     outCel.setEditable( false );
  }
    
  public void convert( )  
  {
    celsTemp = ((fahrTemp-32) * 5) / 9;
  }
   
  public void actionPerformed( ActionEvent evt)  
  {
    String userIn = inFahr.getText() ;
    fahrTemp = Integer.parseInt( userIn ) ;
   
    convert() ;
   
    outCel.setText( celsTemp+" " );
    repaint();   
  }
     
  public static void main ( String[] args )
  {
    FahrConvert   fahr  = new FahrConvert() ;
    
    WindowQuitter wquit = new WindowQuitter(); 
    fahr.addWindowListener( wquit );
    
    fahr.setSize( 200, 150 );     
    fahr.setVisible( true );      
  }
   
}
   
class  WindowQuitter  extends WindowAdapter 
{
  public void windowClosing( WindowEvent e )
  {
    System.exit( 0 ); 
  }
}

QUESTION 7: