Home Segments Top Top Previous Next

896: Mainline

At this point, you readily can install a marquee in the evolving movie-rating application. Because none of the other application instances send information to the marquee, you can add the marquee by subclassing the MovieApplication class provided in Segment 872, placing the marquee in the south slot:

import javax.swing.*; 
import java.awt.event.*; 
import java.util.*; 
public class MovieApplicationWithThread extends MovieApplication { 
 // Declare variables 
 private Marquee marquee; 
 private MarqueeThread thread; 
 // Define constructor 
 public MovieApplicationWithThread () { 
  super(); 
  marquee = new Marquee("Buy On To Java Today!"); 
  thread = new MarqueeThread(marquee); 
  thread.start(); 
  getContentPane().add("South", marquee);                
 } 
}