MXD-Server/src/gui/UI_LenheartUI/ExplosiveControl.java

782 lines
29 KiB
Java
Raw Normal View History

2025-03-12 16:08:54 +08:00
/*
* Created by JFormDesigner on Wed Mar 12 16:06:47 CST 2025
*/
package gui.UI_LenheartUI;
import java.awt.*;
2025-03-13 21:22:16 +08:00
import java.awt.event.*;
2025-03-14 17:11:32 +08:00
import java.io.File;
2025-03-13 21:22:16 +08:00
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
2025-03-14 15:01:36 +08:00
import java.util.List;
2025-03-12 16:08:54 +08:00
import javax.swing.*;
2025-03-13 21:22:16 +08:00
import javax.swing.border.*;
2025-03-14 17:11:32 +08:00
import javax.swing.event.MouseInputAdapter;
2025-03-13 21:22:16 +08:00
import javax.swing.table.*;
import com.intellij.uiDesigner.core.*;
import com.jgoodies.forms.factories.*;
import com.jgoodies.forms.layout.*;
import database.DBConPool;
2025-03-14 15:01:36 +08:00
import gui.tw.Drop;
2025-03-13 21:22:16 +08:00
import info.clearthought.layout.*;
import net.miginfocom.swing.*;
import server.MapleItemInformationProvider;
import server.life.MapleLifeFactory;
import tools.FileoutputUtil;
2025-03-12 16:08:54 +08:00
/**
* @author dongj
*/
public class ExplosiveControl extends JPanel {
public ExplosiveControl() {
initComponents();
}
2025-03-14 15:01:36 +08:00
public void ClearTable(JTable tableobj) {
for (int i = ((DefaultTableModel) (DefaultTableModel) tableobj.getModel()).getRowCount() - 1; i >= 0; --i) {
((DefaultTableModel) (DefaultTableModel) tableobj.getModel()).removeRow(i);
2025-03-13 21:22:16 +08:00
}
}
2025-03-14 15:01:36 +08:00
public void WriteTable2(List<Drop> kps){
DefaultTableModel tableModel = (DefaultTableModel)table2.getModel();
for (Drop kp : kps) {
tableModel.insertRow(this.table2.getRowCount(), new Object[]{Integer.valueOf(kp.getId()), kp.getDropName(), Integer.valueOf(kp.getDropperid()), kp.getItenName(), Integer.valueOf(kp.getItemId()), Integer.valueOf(kp.getChance())});
2025-03-13 21:22:16 +08:00
}
2025-03-14 15:01:36 +08:00
}
public void WriteTable1(List<Drop> kps){
DefaultTableModel tableModel = (DefaultTableModel)table1.getModel();
for (Drop kp : kps) {
tableModel.insertRow(this.table1.getRowCount(), new Object[]{Integer.valueOf(kp.getId()), kp.getItenName(), Integer.valueOf(kp.getItemId()), Integer.valueOf(kp.getChance())});
2025-03-13 21:22:16 +08:00
}
}
2025-03-14 15:01:36 +08:00
private void 加载刷新怪物卡片(ActionEvent e) {
ClearTable(table2);
WriteTable2(Drop.getKPS());
}
2025-03-13 21:22:16 +08:00
private void 刷新怪物爆物数据(ActionEvent e) {
2025-03-14 15:01:36 +08:00
ClearTable(table2);
WriteTable2(Drop.getMobBLs());
ClearTable(table1);
WriteTable1(Drop.getQQS());
}
private void 根据怪物ID清理(ActionEvent e) {
Drop.deleteGWdropperid(Integer.valueOf(this.怪物ID清理.getText()));
ClearTable(table2);
刷新怪物爆物数据(null);
}
private void 根据物品ID清理(ActionEvent e) {
Drop.deleteItemId(Integer.valueOf(this.物品ID清理.getText()));
ClearTable(table1);
ClearTable(table2);
刷新怪物爆物数据(null);
}
private void 一键清空独立爆率表(ActionEvent e) {
Drop.deleteGWAll();
ClearTable(table2);
}
private void 一键清空全局爆率表(ActionEvent e) {
Drop.deleteQJAll();
ClearTable(table1);
}
private void button物品ID查询掉落(ActionEvent e) {
ClearTable(table2);
WriteTable2(Drop.getItemIdsMob(this.物品ID查询掉落.getText()));
}
private void 物品名查询掉落函数(ActionEvent e) {
ClearTable(table2);
WriteTable2(Drop.getItemNamesMob(this.物品名查询掉落.getText()));
}
private void 怪物ID查询掉落函数(ActionEvent e) {
ClearTable(table2);
WriteTable2(Drop.getMobIdsMob(this.怪物ID查询掉落.getText()));
}
private void 怪物名查询掉落函数(ActionEvent e) {
ClearTable(table2);
WriteTable2(Drop.getMobNames(this.怪物名查询掉落.getText()));
2025-03-13 21:22:16 +08:00
}
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);
}
}
}
2025-03-14 15:01:36 +08:00
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;
}
try {
Drop.insertGWId(MonId, ItemId, Chance);
} catch (Exception ee) {
// 显示消息提示框
JOptionPane.showMessageDialog(null, "新增失败检查怪物ID和物品ID是否有误。", "提示", JOptionPane.INFORMATION_MESSAGE);
return;
}
刷新怪物爆物数据(null);
}
private void 独立爆率删除配置(ActionEvent e) {
// TODO add your code here
int selectedRow = table2.getSelectedRow();
if (selectedRow != -1) {
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);
}
}
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;
}
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) {
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
Integer Ids = (Integer) tableModel.getValueAt(selectedRow,0);
Integer MonId = (Integer) tableModel.getValueAt(selectedRow,2);
// TODO add your code here
tableModel.removeRow(selectedRow);
if(tableModel.getRowCount() > selectedRow)table1.setRowSelectionInterval(selectedRow, selectedRow);
}
}
2025-03-14 17:11:32 +08:00
private void 独立爆率一键导入(ActionEvent e) {
// 创建 JFileChooser 实例
JFileChooser fileChooser = new JFileChooser();
// 显示文件选择对话框
int result = fileChooser.showOpenDialog(null);
// 处理用户的选择
if (result == JFileChooser.APPROVE_OPTION) {
// 用户选择了文件
File selectedFile = fileChooser.getSelectedFile();
System.out.println("选择的文件: " + selectedFile.getAbsolutePath());
} else if (result == JFileChooser.CANCEL_OPTION) {
}
}
private void 独立爆率一键导出(ActionEvent e) {
// 创建 JFileChooser 实例
JFileChooser folderChooser = new JFileChooser();
// 设置选择模式为只选择文件夹
folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
// 显示文件夹选择对话框
int result = folderChooser.showOpenDialog(null);
// 处理用户的选择
if (result == JFileChooser.APPROVE_OPTION) {
// 用户选择了文件夹
File selectedFolder = folderChooser.getSelectedFile();
System.out.println("选择的文件夹: " + selectedFolder.getAbsolutePath());
} else if (result == JFileChooser.CANCEL_OPTION) {
}
}
2025-03-14 15:01:36 +08:00
2025-03-12 16:08:54 +08:00
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
2025-03-13 21:22:16 +08:00
panel1 = new JPanel();
button9 = new JButton();
button10 = new JButton();
panel2 = new JPanel();
button11 = new JButton();
panel3 = new JPanel();
2025-03-14 15:01:36 +08:00
怪物ID清理 = new JTextField();
物品ID清理 = new JTextField();
2025-03-13 21:22:16 +08:00
button13 = new JButton();
button14 = new JButton();
2025-03-14 15:01:36 +08:00
label5 = new JLabel();
label6 = new JLabel();
2025-03-13 21:22:16 +08:00
panel4 = new JPanel();
物品ID查询掉落 = new JTextField();
button15 = new JButton();
2025-03-14 15:01:36 +08:00
物品名查询掉落 = new JTextField();
2025-03-13 21:22:16 +08:00
button16 = new JButton();
怪物ID查询掉落 = new JTextField();
button17 = new JButton();
2025-03-14 15:01:36 +08:00
怪物名查询掉落 = new JTextField();
2025-03-13 21:22:16 +08:00
button18 = new JButton();
label1 = new JLabel();
label2 = new JLabel();
label3 = new JLabel();
label4 = new JLabel();
panel5 = new JPanel();
scrollPane3 = new JScrollPane();
table2 = new JTable();
panel6 = new JPanel();
scrollPane1 = new JScrollPane();
table1 = new JTable();
button1 = new JButton();
button2 = new JButton();
button5 = new JButton();
button6 = new JButton();
button3 = new JButton();
button4 = new JButton();
button7 = new JButton();
button8 = new JButton();
button19 = new JButton();
2025-03-14 15:01:36 +08:00
G_1 = new JTextField();
G_2 = new JTextField();
G_3 = new JTextField();
label7 = new JLabel();
label8 = new JLabel();
label9 = new JLabel();
label11 = new JLabel();
G_5 = new JTextField();
label12 = new JLabel();
G_6 = new JTextField();
2025-03-12 16:08:54 +08:00
//======== this ========
setLayout(null);
2025-03-13 21:22:16 +08:00
//======== panel1 ========
{
panel1.setBorder(new TitledBorder("\u5371\u9669\u64cd\u4f5c"));
panel1.setLayout(null);
//---- button9 ----
button9.setText("\u4e00\u952e\u6e05\u7a7a\u72ec\u7acb\u7206\u7387\u8868");
2025-03-14 15:01:36 +08:00
button9.addActionListener(e -> 一键清空独立爆率表(e));
2025-03-13 21:22:16 +08:00
panel1.add(button9);
button9.setBounds(5, 30, 190, button9.getPreferredSize().height);
//---- button10 ----
button10.setText("\u4e00\u952e\u6e05\u7a7a\u5168\u5c40\u7206\u7387\u8868");
2025-03-14 15:01:36 +08:00
button10.addActionListener(e -> 一键清空全局爆率表(e));
2025-03-13 21:22:16 +08:00
panel1.add(button10);
button10.setBounds(5, 60, 190, button10.getPreferredSize().height);
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < panel1.getComponentCount(); i++) {
Rectangle bounds = panel1.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 = panel1.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
panel1.setMinimumSize(preferredSize);
panel1.setPreferredSize(preferredSize);
}
}
add(panel1);
panel1.setBounds(25, 5, 200, 105);
//======== panel2 ========
{
panel2.setBorder(new TitledBorder("\u602a\u7269\u5361\u7247"));
panel2.setLayout(null);
//---- button11 ----
button11.setText("\u52a0\u8f7d\u5237\u65b0\u602a\u7269\u5361\u7247");
button11.addActionListener(e -> 加载刷新怪物卡片(e));
panel2.add(button11);
button11.setBounds(5, 19, 190, button11.getPreferredSize().height);
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < panel2.getComponentCount(); i++) {
Rectangle bounds = panel2.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 = panel2.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
panel2.setMinimumSize(preferredSize);
panel2.setPreferredSize(preferredSize);
}
}
add(panel2);
panel2.setBounds(25, 120, 200, 65);
//======== panel3 ========
{
panel3.setBorder(new TitledBorder("\u5feb\u6377\u6e05\u7406\u6240\u6709\u7206\u7387"));
panel3.setLayout(null);
2025-03-14 15:01:36 +08:00
panel3.add(怪物ID清理);
怪物ID清理.setBounds(10, 35, 115, 怪物ID清理.getPreferredSize().height);
panel3.add(物品ID清理);
物品ID清理.setBounds(10, 85, 115, 物品ID清理.getPreferredSize().height);
2025-03-13 21:22:16 +08:00
//---- button13 ----
button13.setText("\u6e05\u7406");
2025-03-14 15:01:36 +08:00
button13.addActionListener(e -> 根据怪物ID清理(e));
2025-03-13 21:22:16 +08:00
panel3.add(button13);
button13.setBounds(130, 35, 58, 25);
//---- button14 ----
button14.setText("\u6e05\u7406");
2025-03-14 15:01:36 +08:00
button14.addActionListener(e -> 根据物品ID清理(e));
2025-03-13 21:22:16 +08:00
panel3.add(button14);
2025-03-14 15:01:36 +08:00
button14.setBounds(130, 85, 58, 25);
//---- label5 ----
label5.setText("\u6839\u636e\u602a\u7269ID\u6e05\u7406");
panel3.add(label5);
label5.setBounds(15, 20, 85, 17);
//---- label6 ----
label6.setText("\u6839\u636e\u7269\u54c1ID\u6e05\u7406");
panel3.add(label6);
label6.setBounds(15, 70, 85, 17);
2025-03-13 21:22:16 +08:00
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < panel3.getComponentCount(); i++) {
Rectangle bounds = panel3.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 = panel3.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
panel3.setMinimumSize(preferredSize);
panel3.setPreferredSize(preferredSize);
}
}
add(panel3);
panel3.setBounds(25, 200, 200, 125);
//======== panel4 ========
{
panel4.setBorder(new TitledBorder("\u5feb\u6377\u67e5\u8be2"));
panel4.setLayout(null);
panel4.add(物品ID查询掉落);
2025-03-14 15:01:36 +08:00
物品ID查询掉落.setBounds(10, 40, 115, 物品ID查询掉落.getPreferredSize().height);
2025-03-13 21:22:16 +08:00
//---- button15 ----
button15.setText("\u67e5\u8be2");
2025-03-14 15:01:36 +08:00
button15.addActionListener(e -> button物品ID查询掉落(e));
2025-03-13 21:22:16 +08:00
panel4.add(button15);
2025-03-14 15:01:36 +08:00
button15.setBounds(130, 40, 58, 25);
panel4.add(物品名查询掉落);
物品名查询掉落.setBounds(10, 90, 115, 物品名查询掉落.getPreferredSize().height);
2025-03-13 21:22:16 +08:00
//---- button16 ----
button16.setText("\u67e5\u8be2");
2025-03-14 15:01:36 +08:00
button16.addActionListener(e -> 物品名查询掉落函数(e));
2025-03-13 21:22:16 +08:00
panel4.add(button16);
2025-03-14 15:01:36 +08:00
button16.setBounds(130, 90, 58, 25);
2025-03-13 21:22:16 +08:00
panel4.add(怪物ID查询掉落);
2025-03-14 15:01:36 +08:00
怪物ID查询掉落.setBounds(10, 140, 115, 怪物ID查询掉落.getPreferredSize().height);
2025-03-13 21:22:16 +08:00
//---- button17 ----
button17.setText("\u67e5\u8be2");
2025-03-14 15:01:36 +08:00
button17.addActionListener(e -> 怪物ID查询掉落函数(e));
2025-03-13 21:22:16 +08:00
panel4.add(button17);
2025-03-14 15:01:36 +08:00
button17.setBounds(130, 140, 58, 25);
panel4.add(怪物名查询掉落);
怪物名查询掉落.setBounds(10, 190, 115, 怪物名查询掉落.getPreferredSize().height);
2025-03-13 21:22:16 +08:00
//---- button18 ----
button18.setText("\u67e5\u8be2");
2025-03-14 15:01:36 +08:00
button18.addActionListener(e -> 怪物名查询掉落函数(e));
2025-03-13 21:22:16 +08:00
panel4.add(button18);
2025-03-14 15:01:36 +08:00
button18.setBounds(130, 190, 58, 25);
2025-03-13 21:22:16 +08:00
//---- label1 ----
label1.setText("\u7269\u54c1ID\u67e5\u8be2\u6389\u843d");
panel4.add(label1);
label1.setBounds(new Rectangle(new Point(15, 25), label1.getPreferredSize()));
//---- label2 ----
label2.setText("\u7269\u54c1\u540d\u67e5\u8be2\u6389\u843d");
panel4.add(label2);
2025-03-14 15:01:36 +08:00
label2.setBounds(15, 75, 85, 17);
2025-03-13 21:22:16 +08:00
//---- label3 ----
label3.setText("\u602a\u7269ID\u67e5\u8be2\u6389\u843d");
panel4.add(label3);
2025-03-14 15:01:36 +08:00
label3.setBounds(15, 125, 85, 17);
2025-03-13 21:22:16 +08:00
//---- label4 ----
label4.setText("\u602a\u7269\u540d\u67e5\u8be2\u6389\u843d");
panel4.add(label4);
2025-03-14 15:01:36 +08:00
label4.setBounds(15, 175, 85, 17);
2025-03-13 21:22:16 +08:00
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < panel4.getComponentCount(); i++) {
Rectangle bounds = panel4.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 = panel4.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
panel4.setMinimumSize(preferredSize);
panel4.setPreferredSize(preferredSize);
}
}
add(panel4);
2025-03-14 15:01:36 +08:00
panel4.setBounds(25, 340, 200, 235);
2025-03-13 21:22:16 +08:00
//======== panel5 ========
{
panel5.setBorder(new TitledBorder("\u602a\u7269\u72ec\u7acb\u7206\u7387"));
panel5.setLayout(new GridLayout());
//======== scrollPane3 ========
{
//---- table2 ----
table2.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"\u5e8f\u53f7", "\u602a\u7269\u540d", "\u602a\u7269ID", "\u7269\u54c1\u540d", "\u7269\u54c1ID", "\u7206\u7387"
}
) {
Class<?>[] columnTypes = new Class<?>[] {
Integer.class, String.class, Integer.class, String.class, Integer.class, Integer.class
};
@Override
public Class<?> getColumnClass(int columnIndex) {
return columnTypes[columnIndex];
}
});
{
TableColumnModel cm = table2.getColumnModel();
cm.getColumn(1).setMinWidth(180);
cm.getColumn(3).setMinWidth(180);
}
scrollPane3.setViewportView(table2);
}
panel5.add(scrollPane3);
}
add(panel5);
2025-03-14 15:01:36 +08:00
panel5.setBounds(235, 5, 840, 580);
2025-03-13 21:22:16 +08:00
//======== panel6 ========
{
panel6.setBorder(new TitledBorder("\u5168\u5c40\u7206\u7387"));
panel6.setLayout(new GridLayout());
//======== scrollPane1 ========
{
scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
//---- table1 ----
table1.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"\u5e8f\u53f7", "\u7269\u54c1\u540d", "\u7269\u54c1ID", "\u7206\u7387"
}
) {
Class<?>[] columnTypes = new Class<?>[] {
Integer.class, String.class, Integer.class, Integer.class
};
@Override
public Class<?> getColumnClass(int columnIndex) {
return columnTypes[columnIndex];
}
});
{
TableColumnModel cm = table1.getColumnModel();
cm.getColumn(0).setMaxWidth(50);
cm.getColumn(1).setMinWidth(180);
}
scrollPane1.setViewportView(table1);
}
panel6.add(scrollPane1);
}
add(panel6);
2025-03-14 15:01:36 +08:00
panel6.setBounds(1080, 5, 420, 580);
2025-03-13 21:22:16 +08:00
//---- button1 ----
button1.setText("\u65b0\u589e\u914d\u7f6e");
2025-03-14 15:01:36 +08:00
button1.addActionListener(e -> 新增独立爆率配置(e));
2025-03-13 21:22:16 +08:00
add(button1);
2025-03-14 15:01:36 +08:00
button1.setBounds(235, 625, 95, button1.getPreferredSize().height);
2025-03-13 21:22:16 +08:00
//---- button2 ----
button2.setText("\u5220\u9664\u914d\u7f6e");
2025-03-14 15:01:36 +08:00
button2.addActionListener(e -> 独立爆率删除配置(e));
2025-03-13 21:22:16 +08:00
add(button2);
2025-03-14 15:01:36 +08:00
button2.setBounds(345, 625, 95, 34);
2025-03-13 21:22:16 +08:00
//---- button5 ----
button5.setText("\u4e00\u952e\u5bfc\u5165");
2025-03-14 17:11:32 +08:00
button5.addActionListener(e -> 独立爆率一键导入(e));
2025-03-13 21:22:16 +08:00
add(button5);
2025-03-14 15:01:36 +08:00
button5.setBounds(455, 625, 95, 34);
2025-03-13 21:22:16 +08:00
//---- button6 ----
button6.setText("\u4e00\u952e\u5bfc\u51fa");
2025-03-14 17:11:32 +08:00
button6.addActionListener(e -> 独立爆率一键导出(e));
2025-03-13 21:22:16 +08:00
add(button6);
2025-03-14 15:01:36 +08:00
button6.setBounds(560, 625, 95, 34);
2025-03-13 21:22:16 +08:00
//---- button3 ----
button3.setText("\u65b0\u589e\u914d\u7f6e");
2025-03-14 15:01:36 +08:00
button3.addActionListener(e -> 新增全局爆率配置(e));
2025-03-13 21:22:16 +08:00
add(button3);
2025-03-14 15:01:36 +08:00
button3.setBounds(1080, 625, 95, 34);
2025-03-13 21:22:16 +08:00
//---- button4 ----
button4.setText("\u5220\u9664\u914d\u7f6e");
2025-03-14 15:01:36 +08:00
button4.addActionListener(e -> 删除全局爆率配置(e));
2025-03-13 21:22:16 +08:00
add(button4);
2025-03-14 15:01:36 +08:00
button4.setBounds(1185, 625, 95, 34);
2025-03-13 21:22:16 +08:00
//---- button7 ----
button7.setText("\u4e00\u952e\u5bfc\u5165");
add(button7);
2025-03-14 15:01:36 +08:00
button7.setBounds(1290, 625, 95, 34);
2025-03-13 21:22:16 +08:00
//---- button8 ----
button8.setText("\u4e00\u952e\u5bfc\u51fa");
add(button8);
2025-03-14 15:01:36 +08:00
button8.setBounds(1395, 625, 95, 34);
2025-03-13 21:22:16 +08:00
//---- button19 ----
button19.setText("\u5237\u65b0\u602a\u7269\u7206\u7269\u6570\u636e");
button19.addActionListener(e -> 刷新怪物爆物数据(e));
add(button19);
2025-03-14 15:01:36 +08:00
button19.setBounds(45, 585, 155, 60);
//---- G_1 ----
G_1.setToolTipText("\u602a\u7269ID");
add(G_1);
G_1.setBounds(280, 590, 100, 30);
//---- G_2 ----
G_2.setToolTipText("\u7269\u54c1ID");
add(G_2);
G_2.setBounds(425, 590, 100, 30);
//---- G_3 ----
G_3.setToolTipText("\u7206\u7387");
add(G_3);
G_3.setBounds(560, 590, 100, 30);
//---- label7 ----
label7.setText("\u602a\u7269ID");
add(label7);
label7.setBounds(new Rectangle(new Point(240, 595), label7.getPreferredSize()));
//---- label8 ----
label8.setText("\u7269\u54c1ID");
add(label8);
label8.setBounds(385, 595, 37, 17);
//---- label9 ----
label9.setText("\u7206\u7387");
add(label9);
label9.setBounds(530, 595, 37, 17);
//---- label11 ----
label11.setText("\u7269\u54c1ID");
add(label11);
label11.setBounds(1085, 595, 37, 17);
//---- G_5 ----
G_5.setToolTipText("\u7269\u54c1ID");
add(G_5);
G_5.setBounds(1125, 590, 100, 30);
//---- label12 ----
label12.setText("\u7206\u7387");
add(label12);
label12.setBounds(1230, 595, 37, 17);
//---- G_6 ----
G_6.setToolTipText("\u7206\u7387");
add(G_6);
G_6.setBounds(1260, 590, 100, 30);
2025-03-13 21:22:16 +08:00
2025-03-12 16:08:54 +08:00
{
// 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
2025-03-13 21:22:16 +08:00
SetRightL(this.table1);
SetRightL(this.table2);
2025-03-14 17:11:32 +08:00
DefaultTableModel tableModel = (DefaultTableModel) table2.getModel();
// 创建 TableRowSorter 并关联到 JTable
TableRowSorter<DefaultTableModel> sorter = new TableRowSorter<>(tableModel);
table2.setRowSorter(sorter);
DefaultTableModel tableModel1 = (DefaultTableModel) table1.getModel();
// 创建 TableRowSorter 并关联到 JTable
TableRowSorter<DefaultTableModel> sorter1 = new TableRowSorter<>(tableModel1);
table1.setRowSorter(sorter1);
// 为 JTable 添加鼠标监听器
table2.addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
// 获取点击的行和列
int row = table2.rowAtPoint(e.getPoint());
if (row >= 0) {
// 获取点击单元格的值
Object MonId = table2.getValueAt(row, 2);
Object ItemId = table2.getValueAt(row, 4);
Object Chance = table2.getValueAt(row, 5);
G_1.setText(MonId.toString());
G_2.setText(ItemId.toString());
G_3.setText(Chance.toString());
}
}
});
table1.addMouseListener(new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
// 获取点击的行和列
int row = table1.rowAtPoint(e.getPoint());
if (row >= 0) {
// 获取点击单元格的值
Object ItemId = table1.getValueAt(row, 2);
Object Chance = table1.getValueAt(row, 3);
G_5.setText(ItemId.toString());
G_6.setText(Chance.toString());
}
}
});
2025-03-12 16:08:54 +08:00
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
2025-03-13 21:22:16 +08:00
private JPanel panel1;
private JButton button9;
private JButton button10;
private JPanel panel2;
private JButton button11;
private JPanel panel3;
2025-03-14 15:01:36 +08:00
private JTextField 怪物ID清理;
private JTextField 物品ID清理;
2025-03-13 21:22:16 +08:00
private JButton button13;
private JButton button14;
2025-03-14 15:01:36 +08:00
private JLabel label5;
private JLabel label6;
2025-03-13 21:22:16 +08:00
private JPanel panel4;
private JTextField 物品ID查询掉落;
private JButton button15;
2025-03-14 15:01:36 +08:00
private JTextField 物品名查询掉落;
2025-03-13 21:22:16 +08:00
private JButton button16;
private JTextField 怪物ID查询掉落;
private JButton button17;
2025-03-14 15:01:36 +08:00
private JTextField 怪物名查询掉落;
2025-03-13 21:22:16 +08:00
private JButton button18;
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JLabel label4;
private JPanel panel5;
private JScrollPane scrollPane3;
private JTable table2;
private JPanel panel6;
private JScrollPane scrollPane1;
private JTable table1;
private JButton button1;
private JButton button2;
private JButton button5;
private JButton button6;
private JButton button3;
private JButton button4;
private JButton button7;
private JButton button8;
private JButton button19;
2025-03-14 15:01:36 +08:00
private JTextField G_1;
private JTextField G_2;
private JTextField G_3;
private JLabel label7;
private JLabel label8;
private JLabel label9;
private JLabel label11;
private JTextField G_5;
private JLabel label12;
private JTextField G_6;
2025-03-12 16:08:54 +08:00
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
}