From d6df066c1914101b3f28a3666691d499c3c2f07b Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Fri, 14 Mar 2025 17:27:46 +0800 Subject: [PATCH] no message --- src/gui/UI_LenheartUI/ExplosiveControl.java | 66 ++++++++++++++++++--- src/gui/UI_LenheartUI/ExplosiveControl.jfd | 8 +-- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/gui/UI_LenheartUI/ExplosiveControl.java b/src/gui/UI_LenheartUI/ExplosiveControl.java index 29b7eea..055fd05 100644 --- a/src/gui/UI_LenheartUI/ExplosiveControl.java +++ b/src/gui/UI_LenheartUI/ExplosiveControl.java @@ -211,9 +211,7 @@ public class ExplosiveControl extends JPanel { if (result == JFileChooser.APPROVE_OPTION) { // 用户选择了文件 File selectedFile = fileChooser.getSelectedFile(); - System.out.println("选择的文件: " + selectedFile.getAbsolutePath()); - } else if (result == JFileChooser.CANCEL_OPTION) { - + Drop.importDataMob(selectedFile.getAbsolutePath()); } } @@ -223,6 +221,43 @@ public class ExplosiveControl extends JPanel { // 设置选择模式为只选择文件夹 folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + // 创建两个单选按钮 + JRadioButton option1 = new JRadioButton("卡片"); + JRadioButton option2 = new JRadioButton("怪物"); + // 创建按钮组,确保单选效果 + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(option1); + buttonGroup.add(option2); + // 默认选中模式 1 + option1.setSelected(true); + + // 创建一个面板来放置单选按钮 + JPanel optionPanel = new JPanel(); + optionPanel.add(option1); + optionPanel.add(option2); + + // 将面板添加到 JFileChooser 的底部 + folderChooser.setAccessory(optionPanel); + + // 显示文件夹选择对话框 + int result = folderChooser.showOpenDialog(null); + + // 处理用户的选择 + if (result == JFileChooser.APPROVE_OPTION) { + // 用户选择了文件夹 + File selectedFolder = folderChooser.getSelectedFile(); + String selectedMode = option1.isSelected() ? "卡片" : "怪物"; + // 调用你的导出数据方法 + Drop.exportData(selectedFolder.getAbsolutePath() + "/独立爆率" + selectedMode + ".txt", selectedMode.equals("卡片") ? Drop.getKPS(): Drop.getMobBLs()); + } + } + + private void 全局爆率一键导出(ActionEvent e) { + // 创建 JFileChooser 实例 + JFileChooser folderChooser = new JFileChooser(); + // 设置选择模式为只选择文件夹 + folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + // 显示文件夹选择对话框 int result = folderChooser.showOpenDialog(null); @@ -230,9 +265,22 @@ public class ExplosiveControl extends JPanel { if (result == JFileChooser.APPROVE_OPTION) { // 用户选择了文件夹 File selectedFolder = folderChooser.getSelectedFile(); - System.out.println("选择的文件夹: " + selectedFolder.getAbsolutePath()); - } else if (result == JFileChooser.CANCEL_OPTION) { + Drop.exportData(selectedFolder.getAbsolutePath().toString() + "/全局爆率.txt",Drop.getQQS()); + } + } + private void 全局爆率一键导入(ActionEvent e) { + // 创建 JFileChooser 实例 + JFileChooser fileChooser = new JFileChooser(); + + // 显示文件选择对话框 + int result = fileChooser.showOpenDialog(null); + + // 处理用户的选择 + if (result == JFileChooser.APPROVE_OPTION) { + // 用户选择了文件 + File selectedFile = fileChooser.getSelectedFile(); + Drop.importDataQQ(selectedFile.getAbsolutePath()); } } @@ -526,8 +574,6 @@ public class ExplosiveControl extends JPanel { //======== scrollPane1 ======== { - scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); //---- table1 ---- table1.setModel(new DefaultTableModel( @@ -548,14 +594,14 @@ public class ExplosiveControl extends JPanel { { TableColumnModel cm = table1.getColumnModel(); cm.getColumn(0).setMaxWidth(50); - cm.getColumn(1).setMinWidth(180); + cm.getColumn(1).setMinWidth(150); } scrollPane1.setViewportView(table1); } panel6.add(scrollPane1); } add(panel6); - panel6.setBounds(1080, 5, 420, 580); + panel6.setBounds(1080, 5, 410, 580); //---- button1 ---- button1.setText("\u65b0\u589e\u914d\u7f6e"); @@ -595,11 +641,13 @@ public class ExplosiveControl extends JPanel { //---- button7 ---- button7.setText("\u4e00\u952e\u5bfc\u5165"); + button7.addActionListener(e -> 全局爆率一键导入(e)); add(button7); button7.setBounds(1290, 625, 95, 34); //---- button8 ---- button8.setText("\u4e00\u952e\u5bfc\u51fa"); + button8.addActionListener(e -> 全局爆率一键导出(e)); add(button8); button8.setBounds(1395, 625, 95, 34); diff --git a/src/gui/UI_LenheartUI/ExplosiveControl.jfd b/src/gui/UI_LenheartUI/ExplosiveControl.jfd index db12ac9..1b35cb0 100644 --- a/src/gui/UI_LenheartUI/ExplosiveControl.jfd +++ b/src/gui/UI_LenheartUI/ExplosiveControl.jfd @@ -271,8 +271,6 @@ new FormModel { "border": new javax.swing.border.TitledBorder( "全局爆率" ) add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { name: "scrollPane1" - "horizontalScrollBarPolicy": 31 - "verticalScrollBarPolicy": 21 add( new FormComponent( "javax.swing.JTable" ) { name: "table1" "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { @@ -292,14 +290,14 @@ new FormModel { add( null ) }, new java.util.Vector { add( new com.jformdesigner.model.SwingTableColumn( null, 0, 0, 50, true ) ) - add( new com.jformdesigner.model.SwingTableColumn( null, 0, 180, 0, true ) ) + add( new com.jformdesigner.model.SwingTableColumn( null, 0, 150, 0, true ) ) add( null ) add( null ) } ) } ) } ) }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { - "width": 420 + "width": 410 "height": 580 "x": 1080 "y": 5 @@ -366,6 +364,7 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "button7" "text": "一键导入" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "全局爆率一键导入", true ) ) }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { "width": 95 "height": 34 @@ -375,6 +374,7 @@ new FormModel { add( new FormComponent( "javax.swing.JButton" ) { name: "button8" "text": "一键导出" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "全局爆率一键导出", true ) ) }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { "width": 95 "height": 34