import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
public class Test
{
public static void main(String args[])
{
new Test().init();
}
public void init(){
final JFileChooser j = new JFileChooser(new File("d:\\"));
final JFrame jf=new JFrame();
JButton jbtn=new JButton("我点");
jf.add(jbtn);
jbtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
j.showOpenDialog(jf);
}
});
jf.setVisible(true);
jf.setSize(800,600);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}