当前位置: 代码迷 >> J2SE >> 程序一:请看看,为什么出错
  详细解决方案

程序一:请看看,为什么出错

热度:31   发布时间:2016-04-24 01:04:28.0
程序一:请各位高手看看,为什么出错
package jim.searcher;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;

import org.apache.lucene.search.Sort;

 class jiemian {  
JSearcher JS;
JTextField jtfa;  
JButton jba;  
JTextField jtfb;  
JButton jbb;  
JButton jbc;  
JTextArea jta;  
JTextField jtfc;  
JButton jbd;  
JButton jbe;  
public void creatAndShoeGUI()  
{  
JFrame.setDefaultLookAndFeelDecorated(true);  
JFrame frame=new JFrame("搜索器");  
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
 
final JFileChooser fc = new JFileChooser();  
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);  
 
Container con = frame.getContentPane();  
con.setLayout(new BorderLayout());  
 
JPanel jpup = new JPanel();  
jpup.setLayout(new GridLayout(2,2));  
jtfa=new JTextField(30);  
jba=new JButton("选择索引的存放路径");  
jba.addActionListener(new ActionListener()  
{  
public void actionPerformed(ActionEvent e)  
{  
int r=fc.showOpenDialog(null);  
if(r==JFileChooser.APPROVE_OPTION)  
{  
jtfa.setText(fc.getSelectedFile().getPath());  
}  
}  
});  
jtfb=new JTextField(30);  
jbb=new JButton("搜索");  
jbb.addActionListener(  
new ActionListener()  
{  
public void actionPerformed(ActionEvent e)  
{  
try{  
String indexPath=jtfa.getText();  
JS.word = jtfb.getText(); ///
JS.CreatIndex( indexPath,"testFiles","jim");///有错的就是这三句。。。。
JS.ks();///
}  
catch(Exception ex){  
JOptionPane.showMessageDialog(null,"搜索失败!","提示",JOptionPane.ERROR_MESSAGE);  
}  
}  
});  
jpup.add(jtfa);  
jpup.add(jba);  
jpup.add(jtfb);  
jpup.add(jbb);  
jta=new JTextArea(10,30);  
JScrollPane jsp=new JScrollPane(jta);  
JPanel jpdown = new JPanel();  
jpdown.setLayout(new FlowLayout());  
jtfc=new JTextField(35);  
jbd=new JButton("设定导出路径");  
  相关解决方案