From 77d58298d00c11ade8862ca8acb0fdef5a45322e Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期五, 21 三月 2025 17:39:38 +0800
Subject: [PATCH] 修改
---
src/main/java/com/example/client/service/ImportDataService.java | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/example/client/service/ImportDataService.java b/src/main/java/com/example/client/service/ImportDataService.java
index eb77b26..11cd7b8 100644
--- a/src/main/java/com/example/client/service/ImportDataService.java
+++ b/src/main/java/com/example/client/service/ImportDataService.java
@@ -39,6 +39,8 @@
public JPanel FileUpload(JFrame frame, Integer width, Integer heigth) {
JPanel jPanel = new JPanel();
+ /*GridBagLayout layout = new GridBagLayout();
+ jPanel.setLayout(layout);*/
jPanel.setPreferredSize(new Dimension(width, heigth));
JTable table = new JTable();
@@ -48,13 +50,15 @@
JScrollPane scrolltable = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
-
+ scrolltable.setPreferredSize(new Dimension(width-150,heigth));
scrolltable.setViewportView(table);
scrolltable.getViewport().setBackground(Color.WHITE);
JButton browseButton = new JButton("閫夋嫨鏂囦欢");
- jPanel.add(browseButton);
+
jPanel.add(scrolltable);
+ jPanel.add(browseButton);
+
browseButton.addActionListener(new ActionListener() {
@Override
@@ -186,16 +190,21 @@
});
return jPanel;
}
- public String UnzipFile(){
+ public String UnzipFile(JTextArea tips){
+ String massage = "";
String filePath = model.getValueAt(0, 0).toString();
String outputDirectory = UnzipPath;
try {
File zipFile = new File(filePath);
if (!zipFile.exists()) {
+ massage = "ZIP鏂囦欢涓嶅瓨鍦細" + filePath;
+ tips.setText(tips.getText() + massage);
throw new FileNotFoundException("ZIP鏂囦欢涓嶅瓨鍦細" + filePath);
}
if (!zipFile.canRead()) {
+ massage = "鏃犳硶璇诲彇ZIP鏂囦欢锛岃妫�鏌ユ枃浠舵潈闄愶細" + filePath;
+ tips.setText(tips.getText() + massage);
System.err.println("鏃犳硶璇诲彇ZIP鏂囦欢锛岃妫�鏌ユ枃浠舵潈闄愶細" + filePath);
return "false";
}
@@ -236,8 +245,9 @@
}
}
}
- System.out.println("鏂囦欢瑙e帇瀹屾垚锛岀洰鏍囩洰褰曪細" + outputDirectory);
- dataSyncService.importData();
+ massage = "鏂囦欢瑙e帇瀹屾垚锛岀洰鏍囩洰褰曪細" + outputDirectory;
+ tips.setText(tips.getText() + massage);
+ dataSyncService.importData(tips);
} catch (IOException e) {
e.printStackTrace();
return "false";
--
Gitblit v1.9.1