关于文件创建后弹出提示框,求解
public void Event() { createItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ String seprator = File.separator; String filename = "myTest.txt"; String directory = "mydir1" + seprator + "mydir2"; File f = new File(directory,filename); if(f.exists()){ System.out.println("文件名"+f.getAbsolutePath()); System.out.println("文件大小:"+f.length()); }else{ f.getParentFile().mkdirs(); try{ f.createNewFile(); }catch(IOException ioe){ ioe.printStackTrace(); throw new RuntimeException("创建失败!"); } } } });