12 2021 档案
java swing 本地目录或文件选择
摘要:java swing 本地目录或文件选择 直接上代码 JButton fileChoose = new JButton("选择文件或目录"); fileChoose.addActionListener(new ActionListener() { public void actionPerforme
阅读全文
java Swing 窗口关闭
摘要:关于swing窗口问题 叉关闭子窗口并关闭所有窗口 JFrame f_2 = new JFrame("XXX"); f_2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 叉关闭子窗口不关闭其他窗口 JFrame f_2 = new JFrame("X
阅读全文
Java 获取本机桌面目录
摘要://获取本机桌面目录File desktopDir = FileSystemView.getFileSystemView().getHomeDirectory();String desktopPath = desktopDir.getAbsolutePath();
阅读全文
class path resource [classpath:xxx.docx] cannot be opened because it does not exist
摘要:class path resource [classpath:xxx.docx] cannot be opened because it does not exist 这个报错是文件读取不到。 解决办法: //本地读取: File tmpFile = null; try { tmpFile = Re
阅读全文
Java POI 操作word文档内容、表格
摘要:使用场景:基于.docx模板进行内容写入,内容替换 一、pom导入 <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.0.0</version> </dependency> <
阅读全文