From 7454d890537c6ecfcec6f52e88c0448b0df8a7fd Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Tue, 4 Mar 2025 08:28:20 +0800 Subject: [PATCH] =?UTF-8?q?UI=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/database/DBConPool.java | 1 + src/gui/LenheartUI/LenheartUI.java | 50 -- src/gui/LenheartUI/LenheartUI.jfd | 22 - src/gui/UI_LenheartUI/DamageControl.java | 722 +++++++++++++++++++++++ src/gui/UI_LenheartUI/DamageControl.jfd | 542 +++++++++++++++++ src/gui/UI_LenheartUI/ItemRecovery.java | 156 +++++ src/gui/UI_LenheartUI/ItemRecovery.jfd | 79 +++ src/gui/UI_LenheartUI/UI_LenheartUI.java | 15 + src/gui/ppms.java | 26 +- src/gui/特殊控制台.java | 8 +- 10 files changed, 1536 insertions(+), 85 deletions(-) delete mode 100644 src/gui/LenheartUI/LenheartUI.java delete mode 100644 src/gui/LenheartUI/LenheartUI.jfd create mode 100644 src/gui/UI_LenheartUI/DamageControl.java create mode 100644 src/gui/UI_LenheartUI/DamageControl.jfd create mode 100644 src/gui/UI_LenheartUI/ItemRecovery.java create mode 100644 src/gui/UI_LenheartUI/ItemRecovery.jfd create mode 100644 src/gui/UI_LenheartUI/UI_LenheartUI.java diff --git a/src/database/DBConPool.java b/src/database/DBConPool.java index 7336fad..629df10 100644 --- a/src/database/DBConPool.java +++ b/src/database/DBConPool.java @@ -43,6 +43,7 @@ public class DBConPool { private void InitDBConPool() { (DBConPool.dataSource = new DruidDataSource()).setName("mysql_pool"); DBConPool.dataSource.setDriverClassName("com.mysql.jdbc.Driver"); +// DBConPool.dataSource.setUrl("jdbc:mysql://192.168.200.20:" + ServerConstants.SQL_PORT + "/" + ServerConstants.SQL_DATABASE + "?useUnicode=true&characterEncoding=UTF8"); DBConPool.dataSource.setUrl("jdbc:mysql://127.0.0.1:" + ServerConstants.SQL_PORT + "/" + ServerConstants.SQL_DATABASE + "?useUnicode=true&characterEncoding=UTF8"); DBConPool.dataSource.setUsername(ServerConstants.SQL_USER); DBConPool.dataSource.setPassword(ServerConstants.SQL_PASSWORD); diff --git a/src/gui/LenheartUI/LenheartUI.java b/src/gui/LenheartUI/LenheartUI.java deleted file mode 100644 index 0ac325e..0000000 --- a/src/gui/LenheartUI/LenheartUI.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Created by JFormDesigner on Mon Mar 03 15:09:50 CST 2025 - */ - -package gui.LenheartUI; - -import java.awt.*; -import javax.swing.*; - -/** - * @author dongj - */ -public class LenheartUI extends JPanel { - public LenheartUI() { - initComponents(); - } - - private void initComponents() { - // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off - textField1 = new JTextField(); - - //======== this ======== - setLayout(null); - - //---- textField1 ---- - textField1.setText("\u6d4b\u8bd5\u6587\u672c"); - add(textField1); - textField1.setBounds(95, 100, 255, 135); - - { - // compute preferred size - Dimension preferredSize = new Dimension(); - for(int i = 0; i < getComponentCount(); i++) { - Rectangle bounds = getComponent(i).getBounds(); - preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); - preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); - } - Insets insets = getInsets(); - preferredSize.width += insets.right; - preferredSize.height += insets.bottom; - setMinimumSize(preferredSize); - setPreferredSize(preferredSize); - } - // JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on - } - - // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off - private JTextField textField1; - // JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on -} diff --git a/src/gui/LenheartUI/LenheartUI.jfd b/src/gui/LenheartUI/LenheartUI.jfd deleted file mode 100644 index 68d8967..0000000 --- a/src/gui/LenheartUI/LenheartUI.jfd +++ /dev/null @@ -1,22 +0,0 @@ -JFDML JFormDesigner: "9.0.0.0.352" Java: "21.0.6" encoding: "UTF-8" - -new FormModel { - contentType: "form/swing" - root: new FormRoot { - add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jformdesigner.runtime.NullLayout ) ) { - name: "this" - add( new FormComponent( "javax.swing.JTextField" ) { - name: "textField1" - "text": "测试文本" - }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { - "x": 95 - "y": 100 - "width": 255 - "height": 135 - } ) - }, new FormLayoutConstraints( null ) { - "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 400, 300 ) - } ) - } -} diff --git a/src/gui/UI_LenheartUI/DamageControl.java b/src/gui/UI_LenheartUI/DamageControl.java new file mode 100644 index 0000000..7ad47bc --- /dev/null +++ b/src/gui/UI_LenheartUI/DamageControl.java @@ -0,0 +1,722 @@ +/* + * Created by JFormDesigner on Mon Mar 03 22:18:15 CST 2025 + */ + +package gui.UI_LenheartUI; + +import com.alibaba.fastjson.JSONObject; +import gui.Start; +import gui.特殊控制台; + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.table.*; + +/** + * @author dongj + */ +public class DamageControl extends JPanel { + //伤害控制配置 + public static JSONObject Config; + //JTableList + JTable[] Tables; + JButton[] Buttons; + //数组 + String[] T = new String[]{"ddbb","ddzb","ddxs","dbbb","dbzb","dbxs","qgbb","qgzb","qgxs"}; + + public DamageControl() { + Config = Start.ConfigValuesJson; + initComponents(); + //储存表 + Tables = new JTable[]{table1,table2,table3,table4,table5,table6,table7,table8,table9}; + Buttons = new JButton[]{button1,button2,button3,button4,button5,button6,button7,button8,button9,button10,button11,button12,button13,button14,button15,button16,button17,button18}; + + //读取开关 + toggleButton1.setSelected(Config.getInteger("isdd") == 1 ? true : false); + toggleButton2.setSelected(Config.getInteger("isdb") == 1 ? true : false); + toggleButton3.setSelected(Config.getInteger("isqg") == 1 ? true : false); + + //设置属性 + for (int i = 0; i < 9; i++) { + settableui(i,T[i]); + } + } + + private void settableui(Integer Index,String TableName){ + Object JsonObject = Config.get(TableName); + JSONObject JsonBuffer = (JSONObject) JsonObject; + // 使用 entrySet() 遍历键值对 + for (Map.Entry entry : JsonBuffer.entrySet()) { + String key = entry.getKey(); + Integer value = (int)entry.getValue(); + DefaultTableModel tableModel = (DefaultTableModel) Tables[Index].getModel(); + Object[] rowData = {Integer.valueOf(key), value}; + tableModel.addRow(rowData); + } + } + + + private void 多段开关回调(ActionEvent e) { + boolean selected = toggleButton1.isSelected(); + Config.put("isdd", selected ? 1 : 0); + } + + private void 多倍开关回调(ActionEvent e) { + boolean selected = toggleButton2.isSelected(); + Config.put("isdb", selected ? 1 : 0); + } + + private void 切割开关回调(ActionEvent e) { + boolean selected = toggleButton3.isSelected(); + Config.put("isqg", selected ? 1 : 0); + } + + private void InitConfig(Integer Index,String TableName){ + JSONObject Buffer = new JSONObject(); + DefaultTableModel tableModel = (DefaultTableModel) Tables[Index].getModel(); + int rowCount = tableModel.getRowCount(); + + for (int i = 0; i < rowCount; i++) { + String Key = tableModel.getValueAt(i, 0).toString(); + Integer Value = (int) tableModel.getValueAt(i, 1); + Buffer.put(Key,Value); + } + Config.put(TableName, Buffer); + } + + private void 保存配置(ActionEvent e) { + //设置属性 + for (int i = 0; i < 9; i++) { + InitConfig(i,T[i]); + } + + Start.ConfigValuesJson = Config; + 特殊控制台.setTwConfig(); + } + + + /** + * 按换行符分组,再在组内按逗号分隔成两个数据一组 + * @param text 输入的文本 + * @return 分组后的数据列表,外层 List 表示按行分组,内层 List 表示每行内的两个数据一组 + */ + private List> groupByLineAndSplit(String text) { + List> result = new ArrayList<>(); + String[] lines = text.split("\n"); + for (String line : lines) { + List pairs = new ArrayList<>(); + String[] parts = line.split(","); + for (int i = 0; i < parts.length; i += 2) { + if (i + 1 < parts.length) { + pairs.add(new String[]{parts[i].trim(), parts[i + 1].trim()}); + } else { + pairs.add(new String[]{parts[i].trim()}); + } + } + result.add(pairs); + } + return result; + } + + private void 新增按钮回调(ActionEvent e) { + for (int i = 0; i < 18; i++) { + if (e.getSource() == Buttons[i]) { + int buttonNumber = i / 2; + DefaultTableModel tableModel = (DefaultTableModel) Tables[buttonNumber].getModel(); + // 判断 Shift 键是否被按下 + boolean isShiftPressed = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; + if(isShiftPressed){ + JTextPane textPane = new JTextPane(); + JScrollPane scrollPane = new JScrollPane(textPane); + scrollPane.setPreferredSize(new Dimension(300, 200)); + + // 弹出包含富文本框的对话框 + int result = JOptionPane.showConfirmDialog( + null, + scrollPane, + "请输入文本 以 , 分隔", + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.PLAIN_MESSAGE + ); + + // 检查用户是否点击了确定按钮 + if (result == JOptionPane.OK_OPTION) { + // 获取富文本框中的文本 + String inputText = textPane.getText(); + + // 按换行符分组,再在组内按逗号分隔成两个数据一组 + List> groupedData = groupByLineAndSplit(inputText); + for (List group : groupedData) { + for (String[] pair : group) { + if (pair.length == 2) { + Object[] rowData = {pair[0], pair[1]}; + tableModel.addRow(rowData); + } else if (pair.length == 1) { + System.out.println("分组数据错误: " + pair[0] + ", 无对应数据"); + } + } + } + } + }else{ + Object[] rowData = {0, 0}; + tableModel.addRow(rowData); + } + break; + } + } + } + + private void 删除按钮回调(ActionEvent e) { + for (int i = 0; i < 18; i++) { + if (e.getSource() == Buttons[i]) { + int buttonNumber = i / 2; + int selectedRow = Tables[buttonNumber].getSelectedRow(); + if (selectedRow != -1) { + DefaultTableModel tableModel = (DefaultTableModel) Tables[buttonNumber].getModel(); + tableModel.removeRow(selectedRow); + if(tableModel.getRowCount() > selectedRow){ + Tables[buttonNumber].setRowSelectionInterval(selectedRow, selectedRow); + } + } + break; + } + } + } + + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off + scrollPane1 = new JScrollPane(); + table1 = new JTable(); + scrollPane2 = new JScrollPane(); + table2 = new JTable(); + scrollPane3 = new JScrollPane(); + table3 = new JTable(); + scrollPane4 = new JScrollPane(); + table4 = new JTable(); + scrollPane5 = new JScrollPane(); + table5 = new JTable(); + scrollPane6 = new JScrollPane(); + table6 = new JTable(); + scrollPane7 = new JScrollPane(); + table7 = new JTable(); + scrollPane8 = new JScrollPane(); + table8 = new JTable(); + scrollPane9 = new JScrollPane(); + table9 = new JTable(); + label1 = new JLabel(); + label2 = new JLabel(); + label3 = new JLabel(); + toggleButton1 = new JToggleButton(); + button1 = new JButton(); + button2 = new JButton(); + label4 = new JLabel(); + label5 = new JLabel(); + label6 = new JLabel(); + label7 = new JLabel(); + label8 = new JLabel(); + label9 = new JLabel(); + button3 = new JButton(); + button4 = new JButton(); + button5 = new JButton(); + button6 = new JButton(); + button7 = new JButton(); + button8 = new JButton(); + button9 = new JButton(); + button10 = new JButton(); + button11 = new JButton(); + button12 = new JButton(); + button13 = new JButton(); + button14 = new JButton(); + button15 = new JButton(); + button16 = new JButton(); + button17 = new JButton(); + button18 = new JButton(); + toggleButton2 = new JToggleButton(); + toggleButton3 = new JToggleButton(); + button19 = new JButton(); + + //======== this ======== + setBorder(null); + setLayout(null); + + //======== scrollPane1 ======== + { + + //---- table1 ---- + table1.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u4ee3\u7801", "\u6bb5\u6570" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane1.setViewportView(table1); + } + add(scrollPane1); + scrollPane1.setBounds(18, 30, 164, 520); + + //======== scrollPane2 ======== + { + + //---- table2 ---- + table2.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u4ee3\u7801", "\u6bb5\u6570" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane2.setViewportView(table2); + } + add(scrollPane2); + scrollPane2.setBounds(185, 30, 164, 520); + + //======== scrollPane3 ======== + { + + //---- table3 ---- + table3.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u6280\u80fd\u4ee3\u7801", "\u7cfb\u6570" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane3.setViewportView(table3); + } + add(scrollPane3); + scrollPane3.setBounds(352, 30, 164, 520); + + //======== scrollPane4 ======== + { + + //---- table4 ---- + table4.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u4ee3\u7801", "\u500d\u6570" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane4.setViewportView(table4); + } + add(scrollPane4); + scrollPane4.setBounds(516, 30, 164, 520); + + //======== scrollPane5 ======== + { + + //---- table5 ---- + table5.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u4ee3\u7801", "\u500d\u6570" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane5.setViewportView(table5); + } + add(scrollPane5); + scrollPane5.setBounds(680, 30, 164, 520); + + //======== scrollPane6 ======== + { + + //---- table6 ---- + table6.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u6280\u80fd\u4ee3\u7801", "\u7cfb\u6570" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane6.setViewportView(table6); + } + add(scrollPane6); + scrollPane6.setBounds(844, 30, 164, 520); + + //======== scrollPane7 ======== + { + + //---- table7 ---- + table7.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u4ee3\u7801", "\u4f24\u5bb3" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane7.setViewportView(table7); + } + add(scrollPane7); + scrollPane7.setBounds(1008, 30, 164, 520); + + //======== scrollPane8 ======== + { + + //---- table8 ---- + table8.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u4ee3\u7801", "\u4f24\u5bb3" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane8.setViewportView(table8); + } + add(scrollPane8); + scrollPane8.setBounds(1172, 30, 164, 520); + + //======== scrollPane9 ======== + { + + //---- table9 ---- + table9.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u6280\u80fd\u4ee3\u7801", "\u7cfb\u6570" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + scrollPane9.setViewportView(table9); + } + add(scrollPane9); + scrollPane9.setBounds(1336, 30, 164, 520); + + //---- label1 ---- + label1.setText("\u591a\u6bb5\u6570\u636e-\u80cc\u5305"); + add(label1); + label1.setBounds(25, 5, 105, 30); + + //---- label2 ---- + label2.setText("\u591a\u6bb5\u6570\u636e-\u88c5\u5907"); + add(label2); + label2.setBounds(190, 5, 105, 30); + + //---- label3 ---- + label3.setText("\u591a\u6bb5\u6570\u636e-\u7cfb\u6570"); + add(label3); + label3.setBounds(355, 5, 105, 30); + + //---- toggleButton1 ---- + toggleButton1.setText("\u591a\u6bb5\u5f00\u5173"); + toggleButton1.setIcon(new ImageIcon(getClass().getResource("/image/OFF3.png"))); + toggleButton1.setSelectedIcon(new ImageIcon(getClass().getResource("/image/ON3.png"))); + toggleButton1.setFocusPainted(false); + toggleButton1.setContentAreaFilled(false); + toggleButton1.addActionListener(e -> 多段开关回调(e)); + add(toggleButton1); + toggleButton1.setBounds(20, 645, 160, 35); + + //---- button1 ---- + button1.setText("\u65b0\u589e"); + button1.addActionListener(e -> 新增按钮回调(e)); + add(button1); + button1.setBounds(20, 565, 160, button1.getPreferredSize().height); + + //---- button2 ---- + button2.setText("\u5220\u9664"); + button2.addActionListener(e -> 删除按钮回调(e)); + add(button2); + button2.setBounds(20, 605, 160, 34); + + //---- label4 ---- + label4.setText("\u591a\u500d\u6570\u636e-\u80cc\u5305"); + add(label4); + label4.setBounds(520, 5, 105, 30); + + //---- label5 ---- + label5.setText("\u591a\u500d\u6570\u636e-\u88c5\u5907"); + add(label5); + label5.setBounds(685, 5, 105, 30); + + //---- label6 ---- + label6.setText("\u591a\u500d\u6570\u636e-\u7cfb\u6570"); + add(label6); + label6.setBounds(850, 5, 105, 30); + + //---- label7 ---- + label7.setText("\u5207\u5272\u6570\u636e-\u80cc\u5305"); + add(label7); + label7.setBounds(1010, 5, 105, 30); + + //---- label8 ---- + label8.setText("\u5207\u5272\u6570\u636e-\u88c5\u5907"); + add(label8); + label8.setBounds(1175, 5, 105, 30); + + //---- label9 ---- + label9.setText("\u5207\u5272\u6570\u636e-\u7cfb\u6570"); + add(label9); + label9.setBounds(1340, 5, 105, 30); + + //---- button3 ---- + button3.setText("\u65b0\u589e"); + button3.addActionListener(e -> 新增按钮回调(e)); + add(button3); + button3.setBounds(187, 565, 160, 34); + + //---- button4 ---- + button4.setText("\u5220\u9664"); + button4.addActionListener(e -> 删除按钮回调(e)); + add(button4); + button4.setBounds(187, 605, 160, 34); + + //---- button5 ---- + button5.setText("\u65b0\u589e"); + button5.addActionListener(e -> 新增按钮回调(e)); + add(button5); + button5.setBounds(354, 565, 160, 34); + + //---- button6 ---- + button6.setText("\u5220\u9664"); + button6.addActionListener(e -> 删除按钮回调(e)); + add(button6); + button6.setBounds(354, 605, 160, 34); + + //---- button7 ---- + button7.setText("\u65b0\u589e"); + button7.addActionListener(e -> 新增按钮回调(e)); + add(button7); + button7.setBounds(520, 565, 160, 34); + + //---- button8 ---- + button8.setText("\u5220\u9664"); + button8.addActionListener(e -> 删除按钮回调(e)); + add(button8); + button8.setBounds(520, 605, 160, 34); + + //---- button9 ---- + button9.setText("\u65b0\u589e"); + button9.addActionListener(e -> 新增按钮回调(e)); + add(button9); + button9.setBounds(685, 565, 160, 34); + + //---- button10 ---- + button10.setText("\u5220\u9664"); + button10.addActionListener(e -> 删除按钮回调(e)); + add(button10); + button10.setBounds(685, 605, 160, 34); + + //---- button11 ---- + button11.setText("\u65b0\u589e"); + button11.addActionListener(e -> 新增按钮回调(e)); + add(button11); + button11.setBounds(848, 565, 160, 34); + + //---- button12 ---- + button12.setText("\u5220\u9664"); + button12.addActionListener(e -> 删除按钮回调(e)); + add(button12); + button12.setBounds(848, 605, 160, 34); + + //---- button13 ---- + button13.setText("\u65b0\u589e"); + button13.addActionListener(e -> 新增按钮回调(e)); + add(button13); + button13.setBounds(1012, 565, 160, 34); + + //---- button14 ---- + button14.setText("\u5220\u9664"); + button14.addActionListener(e -> 删除按钮回调(e)); + add(button14); + button14.setBounds(1012, 605, 160, 34); + + //---- button15 ---- + button15.setText("\u65b0\u589e"); + button15.addActionListener(e -> 新增按钮回调(e)); + add(button15); + button15.setBounds(1176, 565, 160, 34); + + //---- button16 ---- + button16.setText("\u5220\u9664"); + button16.addActionListener(e -> 删除按钮回调(e)); + add(button16); + button16.setBounds(1176, 605, 160, 34); + + //---- button17 ---- + button17.setText("\u65b0\u589e"); + button17.addActionListener(e -> 新增按钮回调(e)); + add(button17); + button17.setBounds(1340, 565, 160, 34); + + //---- button18 ---- + button18.setText("\u5220\u9664"); + button18.addActionListener(e -> 删除按钮回调(e)); + add(button18); + button18.setBounds(1340, 605, 160, 34); + + //---- toggleButton2 ---- + toggleButton2.setText("\u591a\u500d\u5f00\u5173"); + toggleButton2.setIcon(new ImageIcon(getClass().getResource("/image/OFF3.png"))); + toggleButton2.setSelectedIcon(new ImageIcon(getClass().getResource("/image/ON3.png"))); + toggleButton2.setFocusPainted(false); + toggleButton2.setContentAreaFilled(false); + toggleButton2.addActionListener(e -> 多倍开关回调(e)); + add(toggleButton2); + toggleButton2.setBounds(187, 645, 160, 35); + + //---- toggleButton3 ---- + toggleButton3.setText("\u5207\u5272\u5f00\u5173"); + toggleButton3.setIcon(new ImageIcon(getClass().getResource("/image/OFF3.png"))); + toggleButton3.setSelectedIcon(new ImageIcon(getClass().getResource("/image/ON3.png"))); + toggleButton3.setFocusPainted(false); + toggleButton3.setContentAreaFilled(false); + toggleButton3.addActionListener(e -> 切割开关回调(e)); + add(toggleButton3); + toggleButton3.setBounds(355, 645, 160, 35); + + //---- button19 ---- + button19.setText("\u4fdd\u5b58\u914d\u7f6e"); + button19.addActionListener(e -> 保存配置(e)); + add(button19); + button19.setBounds(520, 645, 160, 35); + + { + // compute preferred size + Dimension preferredSize = new Dimension(); + for(int i = 0; i < getComponentCount(); i++) { + Rectangle bounds = getComponent(i).getBounds(); + preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); + preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); + } + Insets insets = getInsets(); + preferredSize.width += insets.right; + preferredSize.height += insets.bottom; + setMinimumSize(preferredSize); + setPreferredSize(preferredSize); + } + // JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off + private JScrollPane scrollPane1; + private JTable table1; + private JScrollPane scrollPane2; + private JTable table2; + private JScrollPane scrollPane3; + private JTable table3; + private JScrollPane scrollPane4; + private JTable table4; + private JScrollPane scrollPane5; + private JTable table5; + private JScrollPane scrollPane6; + private JTable table6; + private JScrollPane scrollPane7; + private JTable table7; + private JScrollPane scrollPane8; + private JTable table8; + private JScrollPane scrollPane9; + private JTable table9; + private JLabel label1; + private JLabel label2; + private JLabel label3; + private JToggleButton toggleButton1; + private JButton button1; + private JButton button2; + private JLabel label4; + private JLabel label5; + private JLabel label6; + private JLabel label7; + private JLabel label8; + private JLabel label9; + private JButton button3; + private JButton button4; + private JButton button5; + private JButton button6; + private JButton button7; + private JButton button8; + private JButton button9; + private JButton button10; + private JButton button11; + private JButton button12; + private JButton button13; + private JButton button14; + private JButton button15; + private JButton button16; + private JButton button17; + private JButton button18; + private JToggleButton toggleButton2; + private JToggleButton toggleButton3; + private JButton button19; + // JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on +} diff --git a/src/gui/UI_LenheartUI/DamageControl.jfd b/src/gui/UI_LenheartUI/DamageControl.jfd new file mode 100644 index 0000000..6013c93 --- /dev/null +++ b/src/gui/UI_LenheartUI/DamageControl.jfd @@ -0,0 +1,542 @@ +JFDML JFormDesigner: "9.0.0.0.352" Java: "21.0.6" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jformdesigner.runtime.NullLayout ) ) { + name: "this" + "border": sfield com.jformdesigner.model.FormObject NULL_VALUE + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane1" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table1" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "代码" ) + add( "段数" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 18 + "y": 30 + "width": 164 + "height": 520 + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane2" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table2" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "代码" ) + add( "段数" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 185 + "y": 30 + "width": 164 + "height": 520 + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane3" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table3" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "技能代码" ) + add( "系数" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 164 + "height": 520 + "x": 352 + "y": 30 + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane4" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table4" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "代码" ) + add( "倍数" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 164 + "height": 520 + "x": 516 + "y": 30 + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane5" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table5" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "代码" ) + add( "倍数" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 164 + "height": 520 + "x": 680 + "y": 30 + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane6" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table6" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "技能代码" ) + add( "系数" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 164 + "height": 520 + "x": 844 + "y": 30 + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane7" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table7" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "代码" ) + add( "伤害" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 164 + "height": 520 + "x": 1008 + "y": 30 + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane8" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table8" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "代码" ) + add( "伤害" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 164 + "height": 520 + "x": 1172 + "y": 30 + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane9" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table9" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "技能代码" ) + add( "系数" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 164 + "height": 520 + "x": 1336 + "y": 30 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label1" + "text": "多段数据-背包" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 25 + "y": 5 + "width": 105 + "height": 30 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label2" + "text": "多段数据-装备" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 105 + "height": 30 + "x": 190 + "y": 5 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label3" + "text": "多段数据-系数" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 355 + "y": 5 + "width": 105 + "height": 30 + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton1" + "text": "多段开关" + "icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 0, "/image/OFF3.png" ) + "selectedIcon": &SwingIcon1 new com.jformdesigner.model.SwingIcon( 0, "/image/ON3.png" ) + "focusPainted": false + "contentAreaFilled": false + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "多段开关回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 20 + "y": 645 + "width": 160 + "height": 35 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button1" + "text": "新增" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 20 + "y": 565 + "width": 160 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button2" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 20 + "y": 605 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label4" + "text": "多倍数据-背包" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 105 + "height": 30 + "x": 520 + "y": 5 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label5" + "text": "多倍数据-装备" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 105 + "height": 30 + "x": 685 + "y": 5 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label6" + "text": "多倍数据-系数" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 105 + "height": 30 + "x": 850 + "y": 5 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label7" + "text": "切割数据-背包" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 105 + "height": 30 + "x": 1010 + "y": 5 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label8" + "text": "切割数据-装备" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 105 + "height": 30 + "x": 1175 + "y": 5 + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label9" + "text": "切割数据-系数" + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 105 + "height": 30 + "x": 1340 + "y": 5 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button3" + "text": "新增" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 187 + "y": 565 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button4" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 187 + "y": 605 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button5" + "text": "新增" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 354 + "y": 565 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button6" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 354 + "y": 605 + } ) + 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": 160 + "height": 34 + "x": 520 + "y": 565 + } ) + 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": 160 + "height": 34 + "x": 520 + "y": 605 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button9" + "text": "新增" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 685 + "y": 565 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button10" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 685 + "y": 605 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button11" + "text": "新增" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 848 + "y": 565 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button12" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 848 + "y": 605 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button13" + "text": "新增" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 1012 + "y": 565 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button14" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 1012 + "y": 605 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button15" + "text": "新增" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 1176 + "y": 565 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button16" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 1176 + "y": 605 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button17" + "text": "新增" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 1340 + "y": 565 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button18" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 34 + "x": 1340 + "y": 605 + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton2" + "text": "多倍开关" + "icon": #SwingIcon0 + "selectedIcon": #SwingIcon1 + "focusPainted": false + "contentAreaFilled": false + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "多倍开关回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 35 + "x": 187 + "y": 645 + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton3" + "text": "切割开关" + "icon": #SwingIcon0 + "selectedIcon": #SwingIcon1 + "focusPainted": false + "contentAreaFilled": false + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "切割开关回调", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 160 + "height": 35 + "x": 355 + "y": 645 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button19" + "text": "保存配置" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "保存配置", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 520 + "y": 645 + "width": 160 + "height": 35 + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 1900, 875 ) + } ) + } +} diff --git a/src/gui/UI_LenheartUI/ItemRecovery.java b/src/gui/UI_LenheartUI/ItemRecovery.java new file mode 100644 index 0000000..d957953 --- /dev/null +++ b/src/gui/UI_LenheartUI/ItemRecovery.java @@ -0,0 +1,156 @@ +/* + * Created by JFormDesigner on Mon Mar 03 20:47:31 CST 2025 + */ + +package gui.UI_LenheartUI; + +import java.awt.event.*; +import gui.Start; +import gui.特殊控制台; + +import java.awt.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.table.*; +import javax.swing.table.TableColumn; + +/** + * @author dongj + */ +public class ItemRecovery extends JPanel { + public ItemRecovery() { + initComponents(); + } + + private void 删除按钮(ActionEvent e) { + int selectedRow = ItemTable.getSelectedRow(); + if (selectedRow != -1) { + DefaultTableModel tableModel = (DefaultTableModel) ItemTable.getModel(); + tableModel.removeRow(selectedRow); + ItemTable.setRowSelectionInterval(selectedRow, selectedRow); + } + } + + private void 保存配置(ActionEvent e) { + DefaultTableModel tableModel = (DefaultTableModel) ItemTable.getModel(); + int rowCount = tableModel.getRowCount(); + int columnCount = tableModel.getColumnCount(); + + Map> ConfigItemJson = new HashMap<>(); + for (int i = 0; i < rowCount; i++) { + String Key = tableModel.getValueAt(i, 0).toString(); + Integer A = (int) tableModel.getValueAt(i, 1); + Integer B = (int) tableModel.getValueAt(i, 2); + + List Data = new ArrayList<>(); + Data.add(B); + Data.add(A); + ConfigItemJson.put(Key,Data); + } + + Start.ConfigItemJson = ConfigItemJson; + 特殊控制台.setTwConfig(); + } + + private void 新增按钮(ActionEvent e) { + DefaultTableModel tableModel = (DefaultTableModel) ItemTable.getModel(); + Object[] rowData = {0, 0, 0}; + tableModel.addRow(rowData); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off + scrollPane1 = new JScrollPane(); + ItemTable = new JTable(); + 删除按钮 = new JButton(); + 保存配置 = new JButton(); + 新增按钮 = new JButton(); + + //======== this ======== + setLayout(null); + + //======== scrollPane1 ======== + { + + //---- ItemTable ---- + ItemTable.setModel(new DefaultTableModel( + new Object[][] { + }, + new String[] { + "\u5151\u6362\u7269\u54c1\u4ee3\u7801", "\u6240\u9700\u7269\u54c1\u4ee3\u7801", "\u6240\u9700\u7269\u54c1\u6570\u91cf" + } + ) { + Class[] columnTypes = new Class[] { + Integer.class, Integer.class, Integer.class + }; + @Override + public Class getColumnClass(int columnIndex) { + return columnTypes[columnIndex]; + } + }); + { + TableColumnModel cm = ItemTable.getColumnModel(); + cm.getColumn(0).setMinWidth(50); + cm.getColumn(0).setMaxWidth(150); + cm.getColumn(1).setMinWidth(50); + cm.getColumn(1).setMaxWidth(150); + cm.getColumn(2).setMinWidth(50); + cm.getColumn(2).setMaxWidth(150); + } + ItemTable.setAutoCreateRowSorter(true); + ItemTable.setBorder(null); + scrollPane1.setViewportView(ItemTable); + } + add(scrollPane1); + scrollPane1.setBounds(18, 10, 447, 660); + + //---- 删除按钮 ---- + 删除按钮.setText("\u5220\u9664"); + 删除按钮.addActionListener(e -> 删除按钮(e)); + add(删除按钮); + 删除按钮.setBounds(485, 35, 115, 删除按钮.getPreferredSize().height); + + //---- 保存配置 ---- + 保存配置.setText("\u4fdd\u5b58\u914d\u7f6e"); + 保存配置.setActionCommand("\u4fdd\u5b58\u914d\u7f6e"); + 保存配置.addActionListener(e -> 保存配置(e)); + add(保存配置); + 保存配置.setBounds(485, 125, 115, 34); + + //---- 新增按钮 ---- + 新增按钮.setText("\u65b0\u589e"); + 新增按钮.setActionCommand("\u65b0\u589e\u6309\u94ae"); + 新增按钮.addActionListener(e -> 新增按钮(e)); + add(新增按钮); + 新增按钮.setBounds(485, 80, 115, 34); + + setPreferredSize(new Dimension(1640, 695)); + // JFormDesigner - End of component initialization //GEN-END:initComponents @formatter:on + +/* ItemTable.addColumn(new TableColumn(0));*/ + Start.ConfigItemJson.forEach((k, v) -> { + Integer ItemId = Integer.valueOf(k); + Integer NeedItemId = v.get(1); + Integer NeedCount = v.get(0); + + DefaultTableModel tableModel = (DefaultTableModel) ItemTable.getModel(); + Object[] rowData = {ItemId, NeedItemId, NeedCount}; + tableModel.addRow(rowData); + }); + + + + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off + private JScrollPane scrollPane1; + private JTable ItemTable; + private JButton 删除按钮; + private JButton 保存配置; + private JButton 新增按钮; + // JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on +} diff --git a/src/gui/UI_LenheartUI/ItemRecovery.jfd b/src/gui/UI_LenheartUI/ItemRecovery.jfd new file mode 100644 index 0000000..ff891d6 --- /dev/null +++ b/src/gui/UI_LenheartUI/ItemRecovery.jfd @@ -0,0 +1,79 @@ +JFDML JFormDesigner: "9.0.0.0.352" Java: "21.0.6" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jformdesigner.runtime.NullLayout ) { + "autoSize": false + } ) { + name: "this" + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane1" + add( new FormComponent( "javax.swing.JTable" ) { + name: "ItemTable" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector { + add( "兑换物品代码" ) + add( "所需物品代码" ) + add( "所需物品数量" ) + }, new java.util.Vector { + add( class java.lang.Integer ) + add( class java.lang.Integer ) + add( class java.lang.Integer ) + }, new java.util.Vector { + add( null ) + add( null ) + add( null ) + }, new java.util.Vector { + add( new com.jformdesigner.model.SwingTableColumn( null, 0, 50, 150, true ) ) + add( new com.jformdesigner.model.SwingTableColumn( null, 0, 50, 150, true ) ) + add( new com.jformdesigner.model.SwingTableColumn( null, 0, 50, 150, true ) ) + } ) + "autoCreateRowSorter": true + "border": sfield com.jformdesigner.model.FormObject NULL_VALUE + auxiliary() { + "JavaCodeGenerator.variableName": "ItemTable" + } + } ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 18 + "y": 10 + "width": 447 + "height": 660 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "删除按钮" + "text": "删除" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除按钮", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "x": 485 + "y": 35 + "width": 115 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "保存配置" + "text": "保存配置" + "actionCommand": "保存配置" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "保存配置", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 115 + "height": 34 + "x": 485 + "y": 125 + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "新增按钮" + "text": "新增" + "actionCommand": "新增按钮" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增按钮", true ) ) + }, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { + "width": 115 + "height": 34 + "x": 485 + "y": 80 + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 1640, 695 ) + } ) + } +} diff --git a/src/gui/UI_LenheartUI/UI_LenheartUI.java b/src/gui/UI_LenheartUI/UI_LenheartUI.java new file mode 100644 index 0000000..85747b3 --- /dev/null +++ b/src/gui/UI_LenheartUI/UI_LenheartUI.java @@ -0,0 +1,15 @@ +package gui.UI_LenheartUI; + +import javax.swing.*; + +public class UI_LenheartUI { + + private JPanel 物品回收页面; + private JPanel 伤害控制页面; + public UI_LenheartUI(JTabbedPane mainComponent) { + 物品回收页面 = new ItemRecovery(); + 伤害控制页面 = new DamageControl(); + mainComponent.addTab("物品回收设置", 物品回收页面); + mainComponent.addTab("伤害控制设置", 伤害控制页面); + } +} diff --git a/src/gui/ppms.java b/src/gui/ppms.java index 054342c..69c9272 100644 --- a/src/gui/ppms.java +++ b/src/gui/ppms.java @@ -5,13 +5,12 @@ QQ116711496 import java.lang.management.ManagementFactory; -import gui.LenheartUI.LenheartUI; +import gui.UI_LenheartUI.UI_LenheartUI; import server.life.MapleLifeFactory; import handling.channel.handler.DamageParse; import java.net.UnknownHostException; import java.net.InetAddress; -import java.net.URLEncoder; import java.io.InputStream; import java.io.Reader; import java.io.BufferedReader; @@ -68,13 +67,9 @@ import MXDJR.MXDJR; import javax.swing.JOptionPane; import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.logging.Level; -import java.util.logging.Logger; import org.netbeans.lib.awtextra.AbsoluteConstraints; -import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.table.TableModel; import javax.swing.table.DefaultTableModel; @@ -134,11 +129,10 @@ import java.lang.management.MemoryMXBean; import client.inventory.IItem; -import static gui.Start.授权验证; - import javax.swing.JFrame; public class ppms extends JFrame { + private UI_LenheartUI UI_Control; private static ppms instance = new ppms(); public static 玩家控制台 玩家控制台; public static 特殊控制台 特殊控制台; @@ -410,6 +404,7 @@ public class ppms extends JFrame { private JPanel jPanel18; private JPanel jPanel19; private JPanel jPanel2; + private JPanel LenheartUI; private JPanel jPanel20; private JPanel jPanel21; private JPanel jPanel22; @@ -648,6 +643,7 @@ public class ppms extends JFrame { private static JToggleButton 子弹扩充开关; private static JTextField 子弹排序; private JTabbedPane 宠吸功能面板; + private JTabbedPane 贪玩功能面板; private static JTextField 宠吸道具; private JButton 宠物不参与地图初始; private static JToggleButton 宠物不饥饿开关; @@ -912,7 +908,9 @@ public class ppms extends JFrame { this.jScrollPane1 = new JScrollPane(); ppms.outSee = new JTextArea(); this.jPanel2 = new JPanel(); + this.LenheartUI = new JPanel(); this.宠吸功能面板 = new JTabbedPane(); + this.贪玩功能面板 = new JTabbedPane(); ppms.jPanel12 = new JPanel(); ppms.jPanel44 = new JPanel(); this.jLabel16 = new JLabel(); @@ -5470,6 +5468,7 @@ public class ppms extends JFrame { jPanel2Layout.setHorizontalGroup((Group) jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup((Group) jPanel2Layout.createSequentialGroup().addComponent((Component) this.宠吸功能面板, -2, 1495, 32767).addContainerGap())); jPanel2Layout.setVerticalGroup((Group) jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup((Group) jPanel2Layout.createSequentialGroup().addComponent((Component) this.宠吸功能面板, -2, 723, -2).addGap(0, 19, 32767))); ppms.主界面菜单.addTab("游戏设置", (Icon) new ImageIcon(this.getClass().getResource("/image/设置.png")), (Component) this.jPanel2); + this.jPanel38.setBorder((Border) BorderFactory.createTitledBorder("经验金币爆率活动")); this.jPanel40.setBorder((Border) BorderFactory.createTitledBorder("")); this.jLabel87.setText("倍率设置"); @@ -5746,7 +5745,16 @@ public class ppms extends JFrame { jPanel60Layout.setHorizontalGroup((Group) jPanel60Layout.createParallelGroup(Alignment.LEADING).addGroup((Group) jPanel60Layout.createSequentialGroup().addContainerGap().addComponent((Component) this.jScrollPane20, -1, 1485, 32767).addContainerGap())); jPanel60Layout.setVerticalGroup((Group) jPanel60Layout.createParallelGroup(Alignment.LEADING).addComponent((Component) this.jScrollPane20, -1, 742, 32767)); ppms.主界面菜单.addTab("通知内容", (Icon) new ImageIcon(this.getClass().getResource("/image/GM工具.png")), (Component) this.jPanel60); - ppms.主界面菜单.addTab("贪玩定制", (Icon) new ImageIcon(this.getClass().getResource("/image/至尊版工具.png")), new LenheartUI()); + + final GroupLayout LenheartUILayout = new GroupLayout((Container) this.LenheartUI); + this.LenheartUI.setLayout((LayoutManager) LenheartUILayout); + LenheartUILayout.setHorizontalGroup((Group) LenheartUILayout.createParallelGroup(Alignment.LEADING).addGroup((Group) LenheartUILayout.createSequentialGroup().addComponent((Component) this.贪玩功能面板, -2, 1495, 32767).addContainerGap())); + LenheartUILayout.setVerticalGroup((Group) LenheartUILayout.createParallelGroup(Alignment.LEADING).addGroup((Group) LenheartUILayout.createSequentialGroup().addComponent((Component) this.贪玩功能面板, -2, 723, -2).addGap(0, 19, 32767))); + ppms.主界面菜单.addTab("贪玩定制", (Icon) new ImageIcon(this.getClass().getResource("/image/至尊版工具.png")), (Component) this.LenheartUI); + this.LenheartUI.setPreferredSize(new Dimension(LenheartUI.getPreferredSize().width + 10, LenheartUI.getPreferredSize().height)); + this.UI_Control = new UI_LenheartUI(this.贪玩功能面板); + + this.jTextField1.setText("贪玩冒险岛079"); this.getContentPane().add((Component) ppms.主界面菜单, new AbsoluteConstraints(0, 0, 1510, 780)); ppms.清空日志.setBackground(new Color(255, 255, 255)); diff --git a/src/gui/特殊控制台.java b/src/gui/特殊控制台.java index 1e16a8a..7f1a0aa 100644 --- a/src/gui/特殊控制台.java +++ b/src/gui/特殊控制台.java @@ -1004,7 +1004,7 @@ public class 特殊控制台 extends JFrame { public static void initTWinfo(){ String property = System.getProperty("user.dir"); - FileReader fileReader = new FileReader(property + "\\配置文件\\伤害.txt"); + FileReader fileReader = new FileReader(property + "\\配置文件\\伤害控制.ini"); String result = fileReader.readString(); //转json Start.ConfigValuesJson = JSONObject.parseObject(result); @@ -1025,14 +1025,14 @@ public class 特殊控制台 extends JFrame { } - public void setTwConfig() { + public static void setTwConfig() { String string = Start.ConfigValuesJson.toString(); String property = System.getProperty("user.dir"); - FileWriter fileWriter = new FileWriter(new File(property + "\\配置文件\\伤害.txt")); + FileWriter fileWriter = new FileWriter(new File(property + "\\配置文件\\伤害控制.ini")); fileWriter.write(string); String jsonStr = JSONUtil.toJsonStr(Start.ConfigItemJson); - FileWriter fileWriter2 = new FileWriter(new File(property + "\\配置文件\\物品.txt")); + FileWriter fileWriter2 = new FileWriter(new File(property + "\\配置文件\\物品回收.ini")); fileWriter2.write(jsonStr); }