512 lines
20 KiB
Java
512 lines
20 KiB
Java
/*
|
|
* Created by JFormDesigner on Wed Mar 12 16:06:47 CST 2025
|
|
*/
|
|
|
|
package gui.UI_LenheartUI;
|
|
|
|
import java.awt.*;
|
|
import java.awt.event.*;
|
|
import java.sql.Connection;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.ResultSet;
|
|
import java.sql.SQLException;
|
|
import javax.swing.*;
|
|
import javax.swing.border.*;
|
|
import javax.swing.table.*;
|
|
import com.intellij.uiDesigner.core.*;
|
|
import com.jgoodies.forms.factories.*;
|
|
import com.jgoodies.forms.layout.*;
|
|
import database.DBConPool;
|
|
import info.clearthought.layout.*;
|
|
import net.miginfocom.swing.*;
|
|
import server.MapleItemInformationProvider;
|
|
import server.life.MapleLifeFactory;
|
|
import tools.FileoutputUtil;
|
|
|
|
/**
|
|
* @author dongj
|
|
*/
|
|
public class ExplosiveControl extends JPanel {
|
|
public ExplosiveControl() {
|
|
initComponents();
|
|
}
|
|
|
|
private void 加载刷新怪物卡片(ActionEvent e) {
|
|
for (int i = ((DefaultTableModel) (DefaultTableModel) this.table2.getModel()).getRowCount() - 1; i >= 0; --i) {
|
|
((DefaultTableModel) (DefaultTableModel) this.table2.getModel()).removeRow(i);
|
|
}
|
|
try {
|
|
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
|
|
PreparedStatement ps = null;
|
|
ResultSet rs = null;
|
|
ps = con.prepareStatement("SELECT * FROM drop_data WHERE itemid >=2380000&& itemid <2390000");
|
|
rs = ps.executeQuery();
|
|
while (rs.next()) {
|
|
((DefaultTableModel) this.table2.getModel()).insertRow(this.table2.getRowCount(), new Object[]{Integer.valueOf(rs.getInt("id")), Integer.valueOf(rs.getInt("dropperid")), MapleItemInformationProvider.getInstance().getName(rs.getInt("itemid")), Integer.valueOf(rs.getInt("itemid")), Integer.valueOf(rs.getInt("chance"))});
|
|
}
|
|
rs.close();
|
|
ps.close();
|
|
con.close();
|
|
} catch (SQLException ex) {
|
|
System.err.println("[" + FileoutputUtil.CurrentReadable_Time() + "]刷新出错:" + ex.getMessage());
|
|
}
|
|
}
|
|
|
|
public void 刷新怪物爆物(final int type) {
|
|
for (int i = ((DefaultTableModel) (DefaultTableModel) this.table2.getModel()).getRowCount() - 1; i >= 0; --i) {
|
|
((DefaultTableModel) (DefaultTableModel) this.table2.getModel()).removeRow(i);
|
|
}
|
|
try {
|
|
final Connection con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
|
|
PreparedStatement ps = null;
|
|
ResultSet rs = null;
|
|
switch (type) {
|
|
case 0: {
|
|
ps = con.prepareStatement("SELECT * FROM drop_data WHERE itemid !=0");
|
|
rs = ps.executeQuery();
|
|
break;
|
|
}
|
|
case 1: {
|
|
ps = con.prepareStatement("SELECT * FROM drop_data WHERE itemid = ?");
|
|
ps.setInt(1, Integer.valueOf(this.物品ID查询掉落.getText()).intValue());
|
|
rs = ps.executeQuery();
|
|
break;
|
|
}
|
|
case 2: {
|
|
ps = con.prepareStatement("SELECT * FROM drop_data WHERE dropperid = ?");
|
|
ps.setInt(1, Integer.valueOf(this.怪物ID查询掉落.getText()).intValue());
|
|
rs = ps.executeQuery();
|
|
break;
|
|
}
|
|
}
|
|
while (rs.next()) {
|
|
String dropperid = "未知名字";
|
|
try {
|
|
dropperid = MapleLifeFactory.getMonster(Integer.valueOf(rs.getInt("dropperid"))).getStats().getName();
|
|
}catch (Exception e) {}
|
|
((DefaultTableModel) this.table2.getModel()).insertRow(this.table2.getRowCount(), new Object[]{Integer.valueOf(rs.getInt("id")),dropperid, Integer.valueOf(rs.getInt("dropperid")), MapleItemInformationProvider.getInstance().getName(rs.getInt("itemid")), Integer.valueOf(rs.getInt("itemid")), Integer.valueOf(rs.getInt("chance"))});
|
|
}
|
|
rs.close();
|
|
ps.close();
|
|
con.close();
|
|
} catch (SQLException ex) {
|
|
System.err.println("[" + FileoutputUtil.CurrentReadable_Time() + "]怪物暴率出错:" + ex.getMessage());
|
|
}
|
|
}
|
|
|
|
private void 刷新怪物爆物数据(ActionEvent e) {
|
|
刷新怪物爆物(0);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void initComponents() {
|
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
|
panel1 = new JPanel();
|
|
button9 = new JButton();
|
|
button10 = new JButton();
|
|
panel2 = new JPanel();
|
|
button11 = new JButton();
|
|
panel3 = new JPanel();
|
|
textField1 = new JTextField();
|
|
textField2 = new JTextField();
|
|
button13 = new JButton();
|
|
button14 = new JButton();
|
|
panel4 = new JPanel();
|
|
物品ID查询掉落 = new JTextField();
|
|
button15 = new JButton();
|
|
textField4 = new JTextField();
|
|
button16 = new JButton();
|
|
怪物ID查询掉落 = new JTextField();
|
|
button17 = new JButton();
|
|
textField6 = new JTextField();
|
|
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();
|
|
|
|
//======== this ========
|
|
setLayout(null);
|
|
|
|
//======== panel1 ========
|
|
{
|
|
panel1.setBorder(new TitledBorder("\u5371\u9669\u64cd\u4f5c"));
|
|
panel1.setLayout(null);
|
|
|
|
//---- button9 ----
|
|
button9.setText("\u4e00\u952e\u6e05\u7a7a\u72ec\u7acb\u7206\u7387\u8868");
|
|
panel1.add(button9);
|
|
button9.setBounds(5, 30, 190, button9.getPreferredSize().height);
|
|
|
|
//---- button10 ----
|
|
button10.setText("\u4e00\u952e\u6e05\u7a7a\u5168\u5c40\u7206\u7387\u8868");
|
|
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);
|
|
panel3.add(textField1);
|
|
textField1.setBounds(10, 35, 115, textField1.getPreferredSize().height);
|
|
panel3.add(textField2);
|
|
textField2.setBounds(10, 80, 115, textField2.getPreferredSize().height);
|
|
|
|
//---- button13 ----
|
|
button13.setText("\u6e05\u7406");
|
|
panel3.add(button13);
|
|
button13.setBounds(130, 35, 58, 25);
|
|
|
|
//---- button14 ----
|
|
button14.setText("\u6e05\u7406");
|
|
panel3.add(button14);
|
|
button14.setBounds(130, 80, 58, 25);
|
|
|
|
{
|
|
// 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查询掉落);
|
|
物品ID查询掉落.setBounds(10, 45, 115, 物品ID查询掉落.getPreferredSize().height);
|
|
|
|
//---- button15 ----
|
|
button15.setText("\u67e5\u8be2");
|
|
panel4.add(button15);
|
|
button15.setBounds(130, 45, 58, 25);
|
|
panel4.add(textField4);
|
|
textField4.setBounds(10, 115, 115, textField4.getPreferredSize().height);
|
|
|
|
//---- button16 ----
|
|
button16.setText("\u67e5\u8be2");
|
|
panel4.add(button16);
|
|
button16.setBounds(130, 115, 58, 25);
|
|
panel4.add(怪物ID查询掉落);
|
|
怪物ID查询掉落.setBounds(10, 180, 115, 怪物ID查询掉落.getPreferredSize().height);
|
|
|
|
//---- button17 ----
|
|
button17.setText("\u67e5\u8be2");
|
|
panel4.add(button17);
|
|
button17.setBounds(130, 180, 58, 25);
|
|
panel4.add(textField6);
|
|
textField6.setBounds(10, 245, 115, textField6.getPreferredSize().height);
|
|
|
|
//---- button18 ----
|
|
button18.setText("\u67e5\u8be2");
|
|
panel4.add(button18);
|
|
button18.setBounds(130, 245, 58, 25);
|
|
|
|
//---- 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);
|
|
label2.setBounds(15, 91, 85, 17);
|
|
|
|
//---- label3 ----
|
|
label3.setText("\u602a\u7269ID\u67e5\u8be2\u6389\u843d");
|
|
panel4.add(label3);
|
|
label3.setBounds(15, 157, 85, 17);
|
|
|
|
//---- label4 ----
|
|
label4.setText("\u602a\u7269\u540d\u67e5\u8be2\u6389\u843d");
|
|
panel4.add(label4);
|
|
label4.setBounds(15, 223, 85, 17);
|
|
|
|
{
|
|
// 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);
|
|
panel4.setBounds(25, 340, 200, 295);
|
|
|
|
//======== panel5 ========
|
|
{
|
|
panel5.setBorder(new TitledBorder("\u602a\u7269\u72ec\u7acb\u7206\u7387"));
|
|
panel5.setLayout(new GridLayout());
|
|
|
|
//======== scrollPane3 ========
|
|
{
|
|
|
|
//---- table2 ----
|
|
table2.setModel(new DefaultTableModel(
|
|
new Object[][] {
|
|
{null, null, null, null, null, null},
|
|
},
|
|
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);
|
|
panel5.setBounds(235, 5, 840, 620);
|
|
|
|
//======== 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[][] {
|
|
{null, null, null, null},
|
|
},
|
|
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);
|
|
panel6.setBounds(1090, 5, 410, 620);
|
|
|
|
//---- button1 ----
|
|
button1.setText("\u65b0\u589e\u914d\u7f6e");
|
|
add(button1);
|
|
button1.setBounds(383, 625, 95, button1.getPreferredSize().height);
|
|
|
|
//---- button2 ----
|
|
button2.setText("\u5220\u9664\u914d\u7f6e");
|
|
add(button2);
|
|
button2.setBounds(491, 625, 95, 34);
|
|
|
|
//---- button5 ----
|
|
button5.setText("\u4e00\u952e\u5bfc\u5165");
|
|
add(button5);
|
|
button5.setBounds(599, 625, 95, 34);
|
|
|
|
//---- button6 ----
|
|
button6.setText("\u4e00\u952e\u5bfc\u51fa");
|
|
add(button6);
|
|
button6.setBounds(707, 625, 95, 34);
|
|
|
|
//---- button3 ----
|
|
button3.setText("\u65b0\u589e\u914d\u7f6e");
|
|
add(button3);
|
|
button3.setBounds(1090, 625, 95, 34);
|
|
|
|
//---- button4 ----
|
|
button4.setText("\u5220\u9664\u914d\u7f6e");
|
|
add(button4);
|
|
button4.setBounds(1195, 625, 95, 34);
|
|
|
|
//---- button7 ----
|
|
button7.setText("\u4e00\u952e\u5bfc\u5165");
|
|
add(button7);
|
|
button7.setBounds(1300, 625, 95, 34);
|
|
|
|
//---- button8 ----
|
|
button8.setText("\u4e00\u952e\u5bfc\u51fa");
|
|
add(button8);
|
|
button8.setBounds(1405, 625, 95, 34);
|
|
|
|
//---- button19 ----
|
|
button19.setText("\u5237\u65b0\u602a\u7269\u7206\u7269\u6570\u636e");
|
|
button19.addActionListener(e -> 刷新怪物爆物数据(e));
|
|
add(button19);
|
|
button19.setBounds(235, 625, 135, 34);
|
|
|
|
{
|
|
// 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
|
|
|
|
SetRightL(this.table1);
|
|
SetRightL(this.table2);
|
|
|
|
}
|
|
|
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
|
|
private JPanel panel1;
|
|
private JButton button9;
|
|
private JButton button10;
|
|
private JPanel panel2;
|
|
private JButton button11;
|
|
private JPanel panel3;
|
|
private JTextField textField1;
|
|
private JTextField textField2;
|
|
private JButton button13;
|
|
private JButton button14;
|
|
private JPanel panel4;
|
|
private JTextField 物品ID查询掉落;
|
|
private JButton button15;
|
|
private JTextField textField4;
|
|
private JButton button16;
|
|
private JTextField 怪物ID查询掉落;
|
|
private JButton button17;
|
|
private JTextField textField6;
|
|
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;
|
|
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
|
}
|