A good answer might be:

The "close-window" button of the frame and the JTextField for Fahrenheit termperatue input.

Application with GUI

Here is the program (not yet complete.) It is based on the previous example, so most of it should be understandable. Decide what belongs in the program for each button. Look at the graphics at the right as you decide in what order to add components.



import java.awt.*; 
import java.awt.event.*;
import javax.swing.*; 

public class FahrConvert
    
{
  JLabel title    
    = new JLabel("Convert Fahrenheit to Celsius");
  JLabel inJLabel  
    = new JLabel("Fahrenheit    ");
  JLabel outLabel 
    = new JLabel("Celsius ");

  JTextField inFahr =  
  JTextField outCel = new JTextField( 7 );

  int fahrTemp ;  // input  
  int celsTemp ;  // result 
  
  public FahrConvert()   // constructor 
  {  
     // choose the layout manager 
     getContentPane().setLayout( ) ; 

     inFahr.addActionListener( this );
     getContentPane().add(   ) ;
     getContentPane().add(   ) ;
     getContentPane().add( outLabel );   
     getContentPane().add( inFahr );   
     getContentPane().add( outCel );   
     outCel.setEditable( ) ;
  }

   . . . . . .  //

class  WindowQuitter  
  extends  
{
  public void windowClosing( WindowEvent e )
  {
    System.exit( 0 ); 
  }
}

The GUI is nearly complete, but more work is needed:


QUESTION 5:

What method is used to get the text from the input JTextField?