时间:2021-07-01 10:21:17 帮助过:27人阅读
/**
@author yangenxiong
*
*/
class importTableChooser extends JFileChooser {
private MainFrame mainFrame;
private Database db;
public importTableChooser(MainFrame mainFrame, Database db) {
this.mainFrame = mainFrame;
this.db = db;
this.setFileSelectionMode(DIRECTORIES_ONLY);
}
public void approveSelection() {
File file = this.getSelectedFile();
if (file.isDirectory()) {
//用户选择了目录
File targetFile = new File(file.getAbsolutePath() + File.separator +
this.db.getDatabaseName() + ".xls");
this.mainFrame.importTable();
} else {
this.mainFrame.importTable();
}
super.approveSelection();
}
}