資源簡介
可根據(jù)關(guān)鍵字查找文件,包括(*.txt,*.java,*.jsp,*.html,*.htm,*.xml)
(注:新的版本發(fā)布了,加了一些新功能!http://download.csdn.net/source/2914935)
代碼片段和文件信息
package?Txt;
import?java.awt.Color;
import?java.awt.Font;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.event.WindowEvent;
import?java.awt.event.WindowFocusListener;
import?java.io.File;
import?java.io.FileNotFoundException;
import?java.io.FileReader;
import?java.io.IOException;
import?javax.swing.ButtonGroup;
import?javax.swing.DefaultListModel;
import?javax.swing.JButton;
import?javax.swing.JCheckBox;
import?javax.swing.JDialog;
import?javax.swing.JFileChooser;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JList;
import?javax.swing.JOptionPane;
import?javax.swing.JPanel;
import?javax.swing.JRadioButton;
import?javax.swing.JScrollPane;
import?javax.swing.JTabbedPane;
import?javax.swing.JTextArea;
import?javax.swing.JTextField;
import?javax.swing.JToolBar;
import?javax.swing.filechooser.FileFilter;
public?class?SearchText?implements?ActionListener?WindowFocusListener
Runnable?{
Jframe?searchframe?=?new?Jframe();
JDialog?dialog?=?new?JDialog(searchframe?“設(shè)置“);
JPanel?jpanel?=?new?JPanel();
JPanel?checkBoxPanel?=?new?JPanel();
JPanel?radioButtonPanel?=?new?JPanel();
JPanel?buttonPanel?=?new?JPanel();
JLabel?wordLabel?=?new?JLabel(“關(guān)鍵字:“);
JLabel?fileLabel?=?new?JLabel(“搜索范圍:“);
JLabel?stateBar?=?new?JLabel();
JTextField?wordField?=?new?JTextField();
DefaultListModel?listModel?=?new?DefaultListModel();
JList?fileList?=?new?JList(listModel);
JTabbedPane?tabbed?=?new?JTabbedPane();
JToolBar?toolBar?=?new?JToolBar();
JTextArea?resultArea?=?new?JTextArea();
JButton?chooseDialog?=?new?JButton(“選擇“);
JButton?searchButton?=?new?JButton(“搜索“);
JButton?setButton?=?new?JButton(“設(shè)置“);
JButton?aboutButton?=?new?JButton(“關(guān)于“);
JButton?exitButton?=?new?JButton(“退出“);
JButton?saveButton?=?new?JButton(“保存設(shè)置“);
JButton?cancelButton?=?new?JButton(“取消“);
JScrollPane?areaJsp?=?new?JScrollPane(resultArea);
JScrollPane?listJsp?=?new?JScrollPane(fileList);
JFileChooser?fileChooser?=?new?JFileChooser();
ButtonGroup?radioGroup?=?new?ButtonGroup();
JCheckBox?txtCheckBox?=?new?JCheckBox(“*.txt“);
JCheckBox?javaCheckBox?=?new?JCheckBox(“*.java“);
JCheckBox?jspCheckBox?=?new?JCheckBox(“*.jsp“);
JCheckBox?htmlCheckBox?=?new?JCheckBox(“*.html“);
JCheckBox?htmCheckBox?=?new?JCheckBox(“*.htm“);
JCheckBox?xmlCheckBox?=?new?JCheckBox(“*.xml“);
JRadioButton?caseRadioButton?=?new?JRadioButton(“區(qū)分大小寫“);
JRadioButton?unCaseRadioButton?=?new?JRadioButton(“不區(qū)分大小寫“);
File[]?files?=?null;
int?mount?=?0;
boolean?txtIsSelect?=?true?javaIsSelect?=?true?jspIsSelect?=?true
htmlIsSelect?=?true?htmIsSelect?=?true?xmlIsSelect?=?true
caseIsSelect?=?false?unCaseIsSelect?=?true;
public?void?init()?{
searchframe.settitle(“一鍵搜索“);
searchframe.setSize(390?405);
searchframe.setLocationRelativeTo(null);
searchframe.setResizable(false);
searchframe.setDefaultCloseOperation(Jframe.EXIT_ON_CLOS
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????232??2009-08-22?10:26??File\.classpath
?????文件????????500??2009-08-23?09:56??File\.project
?????文件???????7930??2010-03-30?23:49??File\一鍵搜索.jar
?????文件?????????51??2009-08-31?11:37??File\bin\me
?????文件??????12973??2010-08-16?17:40??File\bin\Txt\SearchText.class
?????文件???????1072??2010-08-16?17:40??File\bin\Txt\SearchText$TxtFileFilter.class
?????文件?????????51??2009-08-31?11:37??File\src\me
?????文件??????14277??2010-08-14?16:20??File\src\Txt\SearchText.java
?????目錄??????????0??2010-08-16?17:40??File\bin\me
?????目錄??????????0??2010-08-16?17:40??File\bin\Txt
?????目錄??????????0??2010-07-28?02:04??File\src\me
?????目錄??????????0??2010-07-28?02:04??File\src\Txt
?????目錄??????????0??2010-07-28?02:04??File\bin
?????目錄??????????0??2010-07-28?02:04??File\src
?????目錄??????????0??2010-07-28?02:04??File
-----------?---------??----------?-----??----
????????????????37086????????????????????15
評論
共有 條評論