📄 al_openitem.java
字号:
import java.awt.event.*;
import java.io.*;
import java.util.*;
public class AL_openItem implements ActionListener
{
private WordFinder mainFrame;
private WordList dictionary;
public AL_openItem(WordFinder mainFrame, WordList dictionary)
{
this.mainFrame = mainFrame;
this.dictionary = dictionary;
}
public void actionPerformed(ActionEvent ae)
{
File theFile = mainFrame.openFile(); // 获取选择的文件
if(theFile != null) { // 选择了文件
try {
dictionary.setDictionary(theFile); // 用选定的文件设置词典
mainFrame.setTotal(dictionary.getDictionarySize()); // 显示词典大小
mainFrame.setList(dictionary.getDictionary()); // 显示词典中所有词
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -