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. (Scattering user interface code throughout application code is sometimes called "code sprinkling".) Here is our tiny application with a separate method for the application code:

import java.awt.*; 
import java.awt.event.*;

public class Repeater extends Frame implements ActionListener
{

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

   Label outLabel    = new Label( "Here is Your Name :" ) ;
   TextField outText = new TextField( 15 );
   
   Repeater()                              // constructor
   {  
      setLayout( new FlowLayout() );       // choose the layout manager 
      add( inLabel  ) ;
      add( inText   ) ;
      add( outLabel ) ;
      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 11:

(Try it out: ) Run the program. 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?

Click Here after you have answered the question