修改软件版本功能

master
zhanghai 2 years ago
parent 7533b76ef2
commit 5242c66f7c

@ -357,6 +357,23 @@ public class MyApplication {
leftGbc.gridx = 2;
leftPanel.add(fileChooserButton, leftGbc);
leftGbc.gridx = 0;
leftGbc.gridy = 1;
leftGbc.anchor = GridBagConstraints.WEST;
leftPanel.add(new JLabel("保存路径选择:"), leftGbc);
JTextField savefilePathField = new JTextField(20);
leftGbc.gridx = 1;
leftGbc.gridwidth = 1;
leftPanel.add(savefilePathField, leftGbc);
JButton fileChooserButton2 = new JButton("选择目录");
leftGbc.gridx = 2;
leftPanel.add(fileChooserButton2, leftGbc);
// 文件选择按钮的动作监听器,打开文件选择对话框
fileChooserButton.addActionListener(new ActionListener() {
@Override
@ -371,38 +388,22 @@ public class MyApplication {
}
});
// leftGbc.gridx = 0;
// leftGbc.gridy = 1;
// leftGbc.anchor = GridBagConstraints.WEST;
// leftPanel.add(new JLabel("dpi:"), leftGbc);
// JTextField dpiField = new JTextField(20);
// leftGbc.gridx = 1;
// leftPanel.add(dpiField, leftGbc);
//
// leftGbc.gridx = 0;
// leftGbc.gridy = 2;
// leftPanel.add(new JLabel("胶片长度:"), leftGbc);
// JTextField filmLengthField = new JTextField(20);
// leftGbc.gridx = 1;
// leftPanel.add(filmLengthField, leftGbc);
//
// leftGbc.gridx = 0;
// leftGbc.gridy = 3;
// leftPanel.add(new JLabel("图像格式:"), leftGbc);
// String[] imageFormats = {"图片", "pdf", "word"};
// JComboBox<String> formatComboBox = new JComboBox<>(imageFormats);
// leftGbc.gridx = 1;
// leftPanel.add(formatComboBox, leftGbc);
//
// // 添加图像格式选择框的监听器,可以根据选择的格式执行相应操作
// formatComboBox.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
// String selectedFormat = (String) formatComboBox.getSelectedItem();
// // 在这里执行根据选择的格式的操作
// System.out.println("选择的图像格式: " + selectedFormat);
// }
// });
// 文件选择按钮的动作监听器,打开文件选择对话框
fileChooserButton2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnValue = fileChooser.showOpenDialog(null);
if (returnValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
savefilePathField.setText(selectedFile.getAbsolutePath());
}
}
});
leftGbc.gridx = 1;
@ -440,7 +441,7 @@ public class MyApplication {
// 模拟耗时操作
try {
new CheckService().index(filePathField.getText());
new CheckService().index(filePathField.getText(),savefilePathField.getText());
} catch (IOException ex) {
throw new RuntimeException(ex);
}

@ -35,10 +35,10 @@ public class CheckService {
public static void main(String[] args) throws IOException {
Config.loadConfig();
String path = "C:\\Users\\zhanghai\\Desktop\\桌面\\test\\ppp\\ppp";
new CheckService().index(path);
// new CheckService().index(path);
}
public void index(String path) throws IOException {
public void index(String path,String savepath) throws IOException {
Map<String, IndexPlate> map = new HashMap<>();
findAllDir(path, map);
@ -166,7 +166,7 @@ public class CheckService {
}
}
EasyExcel.write("check" + ".xls", CheckPageRow.class).sheet("test").doWrite(checkPageRows);
EasyExcel.write(savepath+"/check" + ".xls", CheckPageRow.class).sheet("test").doWrite(checkPageRows);
}

Loading…
Cancel
Save