wordfinder.java
来自「一本有关Java图形界面设计的一本书,英文的,附带有源码,」· Java 代码 · 共 45 行
JAVA
45 行
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 { 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().show(); } }); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?