how to import datas from excel to jTable?
问题 JFileChooser fc = new JFileChooser(); int option = fc.showSaveDialog(NewJFrame1.this); if(option == JFileChooser.APPROVE_OPTION){ String filename = fc.getSelectedFile().getName(); String path = fc.getSelectedFile().getParentFile().getPath(); int len = filename.length(); String ext = ""; String file = ""; if(len > 4){ ext = filename.substring(len-4, len); } if(ext.equals(".xls")){ file = path + "\\" + filename; }else{ file = path + "\\" + filename + ".xls"; } toExcel(jTable1, new File(file));