A good answer might be:

These two lines (might) count as the "application code:"

    String name = inText.getText();
    outText.setText( name );

(Although it could be argued that there is no application code because all the code deals with the GUI.)

Application Code in its own Method

In a typical application with a graphical interface, about 40% of the code manages the user interface. The rest of the code is for the application--the reason the program was written. Usually the application code is kept separate from the code that manages the interface. In a big application it would be confusing to mix the two together. Here is our tiny application with a separate method for the application code:

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

public class Repeater extends JFrame implements ActionListener
{

   JLabel inLabel    = new JLabel( "Enter Your Name:  " ) ;
   TextField inText  = new TextField( 15 );

   JLabel outLabel   = new JLabel( "Here is Your Name :" ) ;
   TextField outText = new TextField( 15 );
   
   public Repeater()      // constructor
   {  
      getContentPane().setLayout( new FlowLayout() ); 
      getContentPane().add( inLabel  ) ;
      getContentPane().add( inText   ) ;
      getContentPane().add( outLabel ) ;
      getContentPane().add( outText  ) ;

      inText.addActionListener( this );
   }

  // The application code.
  void copyText()
  {
    String name = inText.getText();
    outText.setText( name );
  }

  public void actionPerformed( ActionEvent evt)  
  {
    copyText();
    repaint();                  
  }

  public static void main ( String[] args )
  {
    Repeater echo  = new Repeater() ;
    
    WindowQuitter wquit = new WindowQuitter(); 
    echo.addWindowListener( wquit );
    
    echo.setSize( 300, 100 );     
    echo.setVisible( true );      
  }
}

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

In large applications the application code and the GUI code are kept in many separate files.

QUESTION 12:

When you enter text into the top TextField and hit enter, the text is copied to the lower TextField. What happends if you enter text into the lower TextField and hit enter?