import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.io.*; import java.util.*; import java.util.List; // we don't want java.awt.List /** * WordFinder is an interface for searching a word list. * When the user types any part of a word, the interface * displays all the words that match. */ public class WordFinder extends JFrame { // define serialVersionUID to prevent a warning private static final long serialVersionUID = 1L; private WordList words = new WordList(); /** * Make a WordFinder window. */ public WordFinder() { super("Word Finder"); // call System.exit() when user closes the window setDefaultCloseOperation(EXIT_ON_CLOSE); } /** * Main method. Makes and displays a WordFinder window. * @param args Command-line arguments. Ignored. */ public static void main(String[] args) { // In general, Swing objects should only be accessed from // the event-handling thread -- not from the main thread // or other threads you create yourself. SwingUtilities.invokeLater() // is a standard idiom for switching to the event-handling thread. SwingUtilities.invokeLater(new Runnable() { public void run () { // Make and display the WordFinder window. new WordFinder().setVisible(true); } }); } }