|  |  |  |  |  |   | 
Now that you understand how events activate 
listener methods, you are ready to move most of this work into the 
constructor of a subclass of the JFrame class.  This subclass is 
called the MovieApplication class because it will evolve, in easy 
steps, to become the foundational class of a fully functional movie-rating 
application.
import javax.swing.*; 
public class MovieApplication extends JFrame { 
 public static void main (String argv []) { 
  new MovieApplication("Movie Application"); 
 } 
 public MovieApplication(String title) { 
  super(title); 
  setSize(350, 150); 
  addWindowListener(new ApplicationClosingWindowListener()); 
  show(); 
 } 
}