Compare commits
	
		
			7 Commits
		
	
	
		
			1a888af6c5
			...
			8651c4f874
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 8651c4f874 | |
|  | 0d20de9f4f | |
|  | 8d7dc39bf5 | |
|  | 30e634531c | |
|  | c298932150 | |
|  | a94f423dda | |
|  | bbbc06bb79 | 
|  | @ -30,6 +30,19 @@ public class DamageControl extends JPanel { | |||
|     //数组 | ||||
|     String[] T = new String[]{"ddbb","ddzb","ddxs","dbbb","dbzb","dbxs","qgbb","qgzb","qgxs"}; | ||||
| 
 | ||||
|     public void SetRightL(JTable tableobj){ | ||||
|         DefaultTableModel tableModel = (DefaultTableModel)tableobj.getModel(); | ||||
| 
 | ||||
|         DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); | ||||
|         rightRenderer.setHorizontalAlignment(JLabel.RIGHT); | ||||
| 
 | ||||
|         for (int i = 0; i < tableobj.getColumnCount(); i++) { | ||||
|             if (tableobj.getColumnClass(i) == String.class) { | ||||
|                 tableobj.getColumnModel().getColumn(i).setCellRenderer(rightRenderer); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public DamageControl() { | ||||
|         Config = Start.ConfigValuesJson; | ||||
|         initComponents(); | ||||
|  | @ -44,6 +57,7 @@ public class DamageControl extends JPanel { | |||
| 
 | ||||
|         //设置属性 | ||||
|         for (int i = 0; i < 9; i++) { | ||||
|             SetRightL(Tables[i]); | ||||
|             settableui(i,T[i]); | ||||
|         } | ||||
|     } | ||||
|  | @ -54,7 +68,7 @@ public class DamageControl extends JPanel { | |||
|         // 使用 entrySet() 遍历键值对 | ||||
|         for (Map.Entry<String, Object> entry : JsonBuffer.entrySet()) { | ||||
|             String key = entry.getKey(); | ||||
|             Integer value = (int)entry.getValue(); | ||||
|             String value = entry.getValue().toString(); | ||||
|             DefaultTableModel tableModel = (DefaultTableModel) Tables[Index].getModel(); | ||||
|             Object[] rowData = {Integer.valueOf(key), value}; | ||||
|             tableModel.addRow(rowData); | ||||
|  | @ -84,7 +98,7 @@ public class DamageControl extends JPanel { | |||
| 
 | ||||
|         for (int i = 0; i < rowCount; i++) { | ||||
|             String Key = tableModel.getValueAt(i, 0).toString(); | ||||
|             Integer Value = (int) tableModel.getValueAt(i, 1); | ||||
|             String Value =  tableModel.getValueAt(i, 1).toString(); | ||||
|             Buffer.put(Key,Value); | ||||
|         } | ||||
|         Config.put(TableName, Buffer); | ||||
|  | @ -258,7 +272,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  | @ -282,7 +296,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  | @ -306,7 +320,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  | @ -330,7 +344,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  | @ -354,7 +368,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  | @ -378,7 +392,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  | @ -402,7 +416,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  | @ -426,7 +440,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  | @ -450,7 +464,7 @@ public class DamageControl extends JPanel { | |||
|                 } | ||||
|             ) { | ||||
|                 Class<?>[] columnTypes = new Class<?>[] { | ||||
|                     Integer.class, Integer.class | ||||
|                     Integer.class, String.class | ||||
|                 }; | ||||
|                 @Override | ||||
|                 public Class<?> getColumnClass(int columnIndex) { | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ new FormModel { | |||
| 						add( "段数" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  | @ -39,7 +39,7 @@ new FormModel { | |||
| 						add( "段数" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  | @ -63,7 +63,7 @@ new FormModel { | |||
| 						add( "系数" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  | @ -87,7 +87,7 @@ new FormModel { | |||
| 						add( "倍数" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  | @ -111,7 +111,7 @@ new FormModel { | |||
| 						add( "倍数" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  | @ -135,7 +135,7 @@ new FormModel { | |||
| 						add( "系数" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  | @ -159,7 +159,7 @@ new FormModel { | |||
| 						add( "伤害" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  | @ -183,7 +183,7 @@ new FormModel { | |||
| 						add( "伤害" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  | @ -207,7 +207,7 @@ new FormModel { | |||
| 						add( "系数" ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.Integer ) | ||||
| 						add( class java.lang.String ) | ||||
| 					}, new java.util.Vector { | ||||
| 						add( null ) | ||||
| 						add( null ) | ||||
|  |  | |||
|  | @ -7,25 +7,15 @@ package gui.UI_LenheartUI; | |||
| import java.awt.*; | ||||
| import java.awt.event.*; | ||||
| import java.io.File; | ||||
| import java.sql.Connection; | ||||
| import java.sql.PreparedStatement; | ||||
| import java.sql.ResultSet; | ||||
| import java.sql.SQLException; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import javax.swing.*; | ||||
| import javax.swing.border.*; | ||||
| import javax.swing.event.MouseInputAdapter; | ||||
| import javax.swing.table.*; | ||||
| import com.intellij.uiDesigner.core.*; | ||||
| import com.jgoodies.forms.factories.*; | ||||
| import com.jgoodies.forms.layout.*; | ||||
| import database.DBConPool; | ||||
| 
 | ||||
| import gui.tw.Drop; | ||||
| import info.clearthought.layout.*; | ||||
| import net.miginfocom.swing.*; | ||||
| import server.MapleItemInformationProvider; | ||||
| import server.life.MapleLifeFactory; | ||||
| import tools.FileoutputUtil; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * @author dongj | ||||
|  | @ -85,23 +75,35 @@ public class ExplosiveControl extends JPanel { | |||
|     } | ||||
| 
 | ||||
|     private void 一键清空独立爆率表(ActionEvent e) { | ||||
|         Drop.deleteGWAll(); | ||||
|         ClearTable(table2); | ||||
|         // 检查 Shift 键是否被按下 | ||||
|         boolean isShiftPressed = (e.getModifiers() & InputEvent.CTRL_MASK) != 0; | ||||
|         if(isShiftPressed){ | ||||
|             Drop.deleteGWAll(); | ||||
|             ClearTable(table2); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void 一键清空全局爆率表(ActionEvent e) { | ||||
|         Drop.deleteQJAll(); | ||||
|         ClearTable(table1); | ||||
|         // 检查 Shift 键是否被按下 | ||||
|         boolean isShiftPressed = (e.getModifiers() & InputEvent.CTRL_MASK) != 0; | ||||
|         if(isShiftPressed){ | ||||
|             Drop.deleteQJAll(); | ||||
|             ClearTable(table1); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void button物品ID查询掉落(ActionEvent e) { | ||||
|         ClearTable(table2); | ||||
|         WriteTable2(Drop.getItemIdsMob(this.物品ID查询掉落.getText())); | ||||
|         ClearTable(table1); | ||||
|         WriteTable1(Drop.getItemIdsQQ(this.物品ID查询掉落.getText())); | ||||
|     } | ||||
| 
 | ||||
|     private void 物品名查询掉落函数(ActionEvent e) { | ||||
|         ClearTable(table2); | ||||
|         WriteTable2(Drop.getItemNamesMob(this.物品名查询掉落.getText())); | ||||
|         ClearTable(table1); | ||||
|         WriteTable1(Drop.getItemNamesQQ(this.物品名查询掉落.getText())); | ||||
|     } | ||||
| 
 | ||||
|     private void 怪物ID查询掉落函数(ActionEvent e) { | ||||
|  | @ -128,75 +130,169 @@ public class ExplosiveControl extends JPanel { | |||
|     } | ||||
| 
 | ||||
|     private void 新增独立爆率配置(ActionEvent e) { | ||||
|         Integer MonId; | ||||
|         Integer ItemId; | ||||
|         Integer Chance; | ||||
|         try { | ||||
|             MonId = Integer.valueOf(this.G_1.getText()); | ||||
|             ItemId = Integer.valueOf(this.G_2.getText()); | ||||
|             Chance = Integer.valueOf(this.G_3.getText()); | ||||
|         } catch (Exception ex) { | ||||
|             JOptionPane.showMessageDialog(null, "新增失败!检查是否填写了全部参数", "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|             return; | ||||
|         // 检查 Shift 键是否被按下 | ||||
|         boolean isShiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0; | ||||
| 
 | ||||
|         if (isShiftPressed) { | ||||
|             // 按住 Shift 键,弹出输入框让用户输入批量数据 | ||||
|             String input = showMultiLineInputDialog(); | ||||
|             if (input != null && !input.isEmpty()) { | ||||
|                 // 分割输入的文本 | ||||
|                 String[] pairs = input.split("\n"); | ||||
|                 for (String pair : pairs) { | ||||
|                     String[] values = pair.split(","); | ||||
|                     if (values.length == 3) { | ||||
|                         try { | ||||
|                             Integer MonId = Integer.valueOf(values[0].trim()); | ||||
|                             Integer itemId = Integer.valueOf(values[1].trim()); | ||||
|                             Integer chance = Integer.valueOf(values[2].trim()); | ||||
|                             Drop.insertGWId(MonId, itemId, chance); | ||||
|                         } catch (NumberFormatException ex) { | ||||
|                             JOptionPane.showMessageDialog(null, "批量添加失败!部分数据格式有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                         } catch (Exception ex) { | ||||
|                             JOptionPane.showMessageDialog(null, "批量添加失败!检查怪物ID和物品ID是否有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                         } | ||||
|                     } else { | ||||
|                         JOptionPane.showMessageDialog(null, "批量添加失败!数据格式有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                     } | ||||
|                 } | ||||
|                 // 刷新怪物爆物数据 | ||||
|                 刷新怪物爆物数据(null); | ||||
|             } | ||||
|         } else { | ||||
|             Integer MonId; | ||||
|             Integer ItemId; | ||||
|             Integer Chance; | ||||
|             try { | ||||
|                 MonId = Integer.valueOf(this.G_1.getText()); | ||||
|                 ItemId = Integer.valueOf(this.G_2.getText()); | ||||
|                 Chance = Integer.valueOf(this.G_3.getText()); | ||||
|             } catch (Exception ex) { | ||||
|                 JOptionPane.showMessageDialog(null, "新增失败!检查是否填写了全部参数", "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|             try { | ||||
|                 Drop.insertGWId(MonId, ItemId, Chance); | ||||
|             } catch (Exception ee) { | ||||
| 
 | ||||
|                 JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             刷新怪物爆物数据(null); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         try { | ||||
|             Drop.insertGWId(MonId, ItemId, Chance); | ||||
|         } catch (Exception ee) { | ||||
|              | ||||
|             JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         刷新怪物爆物数据(null); | ||||
|     } | ||||
| 
 | ||||
|     private void 独立爆率删除配置(ActionEvent e) { | ||||
|          | ||||
|         int selectedRow = table2.getSelectedRow(); | ||||
|         if (selectedRow != -1) { | ||||
|         int[] selectedRows = table2.getSelectedRows(); | ||||
|         if (selectedRows.length > 0) { | ||||
|             DefaultTableModel tableModel = (DefaultTableModel) table2.getModel(); | ||||
|             Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0); | ||||
|             Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2); | ||||
|             Drop.deleteGWId(Ids,MonId); | ||||
|             tableModel.removeRow(selectedRow); | ||||
|             if(tableModel.getRowCount() > selectedRow)table2.setRowSelectionInterval(selectedRow, selectedRow); | ||||
| 
 | ||||
|             // 由于删除行后索引会改变,为了避免索引混乱,从后往前删除 | ||||
|             for (int i = selectedRows.length - 1; i >= 0; i--) { | ||||
|                 int selectedRow = selectedRows[i]; | ||||
|                 // 将视图中的行索引转换为 TableModel 中的实际行索引 | ||||
|                 int modelRow = table2.convertRowIndexToModel(selectedRow); | ||||
| 
 | ||||
|                 Integer Ids = (Integer) tableModel.getValueAt(modelRow, 0); | ||||
|                 Integer MonId = (Integer) tableModel.getValueAt(modelRow, 2); | ||||
| 
 | ||||
|                 Drop.deleteGWId(Ids, MonId); | ||||
|                 tableModel.removeRow(modelRow); | ||||
|             } | ||||
|             if (tableModel.getRowCount() > 0) { | ||||
|                 int newSelectedRow = Math.min(selectedRows[0], tableModel.getRowCount() - 1); | ||||
|                 table2.setRowSelectionInterval(newSelectedRow, newSelectedRow); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private String showMultiLineInputDialog() { | ||||
|         JTextArea textArea = new JTextArea(15, 40); | ||||
|         textArea.setLineWrap(true); | ||||
|         textArea.setWrapStyleWord(true); | ||||
| 
 | ||||
|         int option = JOptionPane.showConfirmDialog( | ||||
|                 null, | ||||
|                 new JScrollPane(textArea), | ||||
|                 "批量添加", | ||||
|                 JOptionPane.OK_CANCEL_OPTION, | ||||
|                 JOptionPane.PLAIN_MESSAGE | ||||
|         ); | ||||
| 
 | ||||
|         return (option == JOptionPane.OK_OPTION) ? textArea.getText().trim() : null; | ||||
|     } | ||||
| 
 | ||||
|     private void 新增全局爆率配置(ActionEvent e) { | ||||
|         Integer ItemId; | ||||
|         Integer Chance; | ||||
|         try { | ||||
|             ItemId = Integer.valueOf(this.G_5.getText()); | ||||
|             Chance = Integer.valueOf(this.G_6.getText()); | ||||
|         } catch (Exception ex) { | ||||
|             JOptionPane.showMessageDialog(null, "新增失败!检查是否填写了全部参数", "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|             return; | ||||
|         // 检查 Shift 键是否被按下 | ||||
|         boolean isShiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0; | ||||
| 
 | ||||
|         if (isShiftPressed) { | ||||
|             // 按住 Shift 键,弹出输入框让用户输入批量数据 | ||||
|             String input = showMultiLineInputDialog(); | ||||
|             if (input != null && !input.isEmpty()) { | ||||
|                 // 分割输入的文本 | ||||
|                 String[] pairs = input.split("\n"); | ||||
|                 for (String pair : pairs) { | ||||
|                     String[] values = pair.split(","); | ||||
|                     if (values.length == 2) { | ||||
|                         try { | ||||
|                             Integer itemId = Integer.valueOf(values[0].trim()); | ||||
|                             Integer chance = Integer.valueOf(values[1].trim()); | ||||
|                             Drop.insertQQ(itemId, chance); | ||||
|                         } catch (NumberFormatException ex) { | ||||
|                             JOptionPane.showMessageDialog(null, "批量添加失败!部分数据格式有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                         } catch (Exception ex) { | ||||
|                             JOptionPane.showMessageDialog(null, "批量添加失败!检查怪物ID和物品ID是否有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                         } | ||||
|                     } else { | ||||
|                         JOptionPane.showMessageDialog(null, "批量添加失败!数据格式有误:" + pair, "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                     } | ||||
|                 } | ||||
|                 // 刷新怪物爆物数据 | ||||
|                 刷新怪物爆物数据(null); | ||||
|             } | ||||
|         } else { | ||||
|             // 正常点击,执行单条数据添加逻辑 | ||||
|             Integer ItemId; | ||||
|             Integer Chance; | ||||
|             try { | ||||
|                 ItemId = Integer.valueOf(G_5.getText()); | ||||
|                 Chance = Integer.valueOf(G_6.getText()); | ||||
|             } catch (Exception ex) { | ||||
|                 JOptionPane.showMessageDialog(null, "新增失败!检查是否填写了全部参数", "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             try { | ||||
|                 Drop.insertQQ(ItemId, Chance); | ||||
|             } catch (Exception ee) { | ||||
|                 JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             // 刷新怪物爆物数据 | ||||
|             刷新怪物爆物数据(null); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         try { | ||||
|             Drop.insertQQ( ItemId, Chance); | ||||
|         } catch (Exception ee) { | ||||
|              | ||||
|             JOptionPane.showMessageDialog(null, "新增失败!检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE); | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         刷新怪物爆物数据(null); | ||||
|     } | ||||
| 
 | ||||
|     private void 删除全局爆率配置(ActionEvent e) { | ||||
|         int selectedRow = table1.getSelectedRow(); | ||||
|         if (selectedRow != -1) { | ||||
|         int[] selectedRows = table1.getSelectedRows(); | ||||
|         if (selectedRows.length > 0) { | ||||
|             DefaultTableModel tableModel = (DefaultTableModel) table1.getModel(); | ||||
|             Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0); | ||||
|             Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2); | ||||
|              | ||||
|             tableModel.removeRow(selectedRow); | ||||
|             if(tableModel.getRowCount() > selectedRow)table1.setRowSelectionInterval(selectedRow, selectedRow); | ||||
|             for (int i = selectedRows.length - 1; i >= 0; i--) { | ||||
|                 int selectedRow = selectedRows[i]; | ||||
|                 int modelRow = table1.convertRowIndexToModel(selectedRow); | ||||
|                 Integer Ids = (Integer) tableModel.getValueAt(modelRow, 0); | ||||
|                 Drop.deleteQQId(Ids); | ||||
|                 tableModel.removeRow(modelRow); | ||||
|             } | ||||
|             if (tableModel.getRowCount() > 0) { | ||||
|                 int newSelectedRow = Math.min(selectedRows[0], tableModel.getRowCount() - 1); | ||||
|                 table1.setRowSelectionInterval(newSelectedRow, newSelectedRow); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ new FormModel { | |||
| 			name: "this" | ||||
| 			add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jformdesigner.runtime.NullLayout ) ) { | ||||
| 				name: "panel1" | ||||
| 				"border": new javax.swing.border.TitledBorder( "危险操作" ) | ||||
| 				"border": new javax.swing.border.TitledBorder( "危险操作 - 按住Ctrl点击生效" ) | ||||
| 				add( new FormComponent( "javax.swing.JButton" ) { | ||||
| 					name: "button9" | ||||
| 					"text": "一键清空独立爆率表" | ||||
|  |  | |||
|  | @ -41,6 +41,7 @@ public class FightControl extends JPanel { | |||
|     } | ||||
| 
 | ||||
|     private void 保存配置(ActionEvent e) { | ||||
|         Start.zlkg = this.toggleButton3.isSelected() ? 1 : 0; | ||||
| 
 | ||||
|         List<ZLConfig> Buf = new ArrayList<>(); | ||||
|         DefaultTableModel tableModel = (DefaultTableModel) table1.getModel(); | ||||
|  | @ -58,9 +59,16 @@ public class FightControl extends JPanel { | |||
|             Buf.add(buffer); | ||||
|         } | ||||
|         Start.zlConfigs = Buf; | ||||
| 
 | ||||
|         String[] originalArray = this.textArea1.getText().split(","); // 按逗号切割成数组 | ||||
|         Start.shxs = originalArray; | ||||
|         特殊控制台.setTwConfig(); | ||||
|     } | ||||
| 
 | ||||
|     private void 战力开关(ActionEvent e) { | ||||
|         // TODO add your code here | ||||
|     } | ||||
| 
 | ||||
|     private void initComponents() { | ||||
|         // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off | ||||
|         scrollPane1 = new JScrollPane(); | ||||
|  | @ -68,6 +76,11 @@ public class FightControl extends JPanel { | |||
|         button21 = new JButton(); | ||||
|         button19 = new JButton(); | ||||
|         button25 = new JButton(); | ||||
|         toggleButton3 = new JToggleButton(); | ||||
|         label3 = new JLabel(); | ||||
|         label1 = new JLabel(); | ||||
|         scrollPane2 = new JScrollPane(); | ||||
|         textArea1 = new JTextArea(); | ||||
| 
 | ||||
|         //======== this ======== | ||||
|         setLayout(null); | ||||
|  | @ -100,19 +113,48 @@ public class FightControl extends JPanel { | |||
|         button21.setText("\u5220\u9664\u914d\u7f6e"); | ||||
|         button21.addActionListener(e -> 删除配置(e)); | ||||
|         add(button21); | ||||
|         button21.setBounds(375, 620, 100, 35); | ||||
|         button21.setBounds(375, 615, 100, 35); | ||||
| 
 | ||||
|         //---- button19 ---- | ||||
|         button19.setText("\u4fdd\u5b58\u914d\u7f6e"); | ||||
|         button19.addActionListener(e -> 保存配置(e)); | ||||
|         add(button19); | ||||
|         button19.setBounds(20, 620, 100, 35); | ||||
|         button19.setBounds(525, 615, 100, 35); | ||||
| 
 | ||||
|         //---- button25 ---- | ||||
|         button25.setText("\u65b0\u589e\u914d\u7f6e"); | ||||
|         button25.addActionListener(e -> 新增配置(e)); | ||||
|         add(button25); | ||||
|         button25.setBounds(270, 620, 100, 35); | ||||
|         button25.setBounds(270, 615, 100, 35); | ||||
| 
 | ||||
|         //---- toggleButton3 ---- | ||||
|         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(20, 615, 100, 35); | ||||
| 
 | ||||
|         //---- label3 ---- | ||||
|         label3.setText("\u6218\u529b\u5f00\u5173"); | ||||
|         add(label3); | ||||
|         label3.setBounds(125, 620, 185, 30); | ||||
| 
 | ||||
|         //---- label1 ---- | ||||
|         label1.setText("\u4f24\u5bb3\u663e\u793a\u5355\u4f4d"); | ||||
|         add(label1); | ||||
|         label1.setBounds(new Rectangle(new Point(490, 10), label1.getPreferredSize())); | ||||
| 
 | ||||
|         //======== scrollPane2 ======== | ||||
|         { | ||||
| 
 | ||||
|             //---- textArea1 ---- | ||||
|             textArea1.setLineWrap(true); | ||||
|             scrollPane2.setViewportView(textArea1); | ||||
|         } | ||||
|         add(scrollPane2); | ||||
|         scrollPane2.setBounds(490, 35, 940, 110); | ||||
| 
 | ||||
|         { | ||||
|             // compute preferred size | ||||
|  | @ -130,6 +172,9 @@ public class FightControl extends JPanel { | |||
|         } | ||||
|         // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on | ||||
| 
 | ||||
| 
 | ||||
|         this.toggleButton3.setSelected(Start.zlkg == 1 ? true : false); | ||||
| 
 | ||||
|         DefaultTableModel tableModel = (DefaultTableModel)this.table1.getModel(); | ||||
|         // 创建一个自定义的单元格渲染器,用于右对齐字符串 | ||||
|         DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); | ||||
|  | @ -149,6 +194,15 @@ public class FightControl extends JPanel { | |||
|             Object[] rowData = {Count, NameFront ,NameBack}; | ||||
|             tableModel.addRow(rowData); | ||||
|         }); | ||||
| 
 | ||||
| 
 | ||||
|         String XB = ""; | ||||
|         for (String shx : Start.shxs) { | ||||
|             XB += shx; | ||||
|             XB += ","; | ||||
|         } | ||||
|         XB = XB.substring(0, XB.length() - 1); | ||||
|         this.textArea1.setText(XB); | ||||
|     } | ||||
| 
 | ||||
|     // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off | ||||
|  | @ -157,5 +211,10 @@ public class FightControl extends JPanel { | |||
|     private JButton button21; | ||||
|     private JButton button19; | ||||
|     private JButton button25; | ||||
|     private JToggleButton toggleButton3; | ||||
|     private JLabel label3; | ||||
|     private JLabel label1; | ||||
|     private JScrollPane scrollPane2; | ||||
|     private JTextArea textArea1; | ||||
|     // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on | ||||
| } | ||||
|  |  | |||
|  | @ -40,7 +40,7 @@ new FormModel { | |||
| 				"width": 100 | ||||
| 				"height": 35 | ||||
| 				"x": 375 | ||||
| 				"y": 620 | ||||
| 				"y": 615 | ||||
| 			} ) | ||||
| 			add( new FormComponent( "javax.swing.JButton" ) { | ||||
| 				name: "button19" | ||||
|  | @ -49,8 +49,8 @@ new FormModel { | |||
| 			}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { | ||||
| 				"width": 100 | ||||
| 				"height": 35 | ||||
| 				"x": 20 | ||||
| 				"y": 620 | ||||
| 				"x": 525 | ||||
| 				"y": 615 | ||||
| 			} ) | ||||
| 			add( new FormComponent( "javax.swing.JButton" ) { | ||||
| 				name: "button25" | ||||
|  | @ -60,8 +60,49 @@ new FormModel { | |||
| 				"width": 100 | ||||
| 				"height": 35 | ||||
| 				"x": 270 | ||||
| 				"y": 615 | ||||
| 			} ) | ||||
| 			add( new FormComponent( "javax.swing.JToggleButton" ) { | ||||
| 				name: "toggleButton3" | ||||
| 				"icon": new com.jformdesigner.model.SwingIcon( 0, "/image/OFF3.png" ) | ||||
| 				"selectedIcon": 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 ) { | ||||
| 				"width": 100 | ||||
| 				"height": 35 | ||||
| 				"x": 20 | ||||
| 				"y": 615 | ||||
| 			} ) | ||||
| 			add( new FormComponent( "javax.swing.JLabel" ) { | ||||
| 				name: "label3" | ||||
| 				"text": "战力开关" | ||||
| 			}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { | ||||
| 				"width": 185 | ||||
| 				"height": 30 | ||||
| 				"x": 125 | ||||
| 				"y": 620 | ||||
| 			} ) | ||||
| 			add( new FormComponent( "javax.swing.JLabel" ) { | ||||
| 				name: "label1" | ||||
| 				"text": "伤害显示单位" | ||||
| 			}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { | ||||
| 				"x": 490 | ||||
| 				"y": 10 | ||||
| 			} ) | ||||
| 			add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { | ||||
| 				name: "scrollPane2" | ||||
| 				add( new FormComponent( "javax.swing.JTextArea" ) { | ||||
| 					name: "textArea1" | ||||
| 					"lineWrap": true | ||||
| 				} ) | ||||
| 			}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) { | ||||
| 				"x": 490 | ||||
| 				"y": 35 | ||||
| 				"width": 940 | ||||
| 				"height": 110 | ||||
| 			} ) | ||||
| 		}, new FormLayoutConstraints( null ) { | ||||
| 			"location": new java.awt.Point( 0, 0 ) | ||||
| 			"size": new java.awt.Dimension( 1570, 670 ) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue