private void saveData() { String path = jtfConfigPath.getText(); if (path == null || path.length() < 1) { JOptionPane.showMessageDialog(this, "文件目录不能为空!"); return; } List<String> addList = new ArrayList<>(); List<String> upList = new ArrayList<>(); Properties config = LocalResourcesUtil.getProperties(path); for (int i = 0; i < tmDbInfo.getRowCount(); i++) { String code = tmDbInfo.getValueAt(i, 0).toString(); if (config.containsKey(code)) { upList.add(config.getProperty(code)); config.remove(code); } else { addList.add(StringUtils.unite(code, "DBConfig.properties")); } } StringBuilder sb = new StringBuilder(); sb.append(StringUtils.unite("本次\r\n新增:", addList, "\r\n")); sb.append(StringUtils.unite("修改:", upList, "\r\n")); sb.append(StringUtils.unite("删除:", config.values(), "\r\n")); int isOk = JOptionPane.showConfirmDialog(this, sb.toString(), "确认要保存吗?", JOptionPane.OK_CANCEL_OPTION); if (isOk == 0) { if (tmDbInfo.saveList(path)) { JOptionPane.showMessageDialog(this, "保存成功!"); } else { JOptionPane.showMessageDialog(this, "保存失败。"); } } }