no message
This commit is contained in:
parent
30dff88b76
commit
75fb694113
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* Created by JFormDesigner on Wed Mar 12 16:10:03 CST 2025
|
||||
*/
|
||||
|
||||
package gui.UI_LenheartUI;
|
||||
|
||||
import gui.Start;
|
||||
import gui.tw.BlConfig;
|
||||
import gui.tw.ZLConfig;
|
||||
import gui.特殊控制台;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
|
||||
/**
|
||||
* @author dongj
|
||||
*/
|
||||
public class FightControl extends JPanel {
|
||||
public FightControl() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void 新增配置(ActionEvent e) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel)this.table1.getModel();
|
||||
Object[] rowData = {0, 0 ,0,0,0, 0};
|
||||
tableModel.addRow(rowData);
|
||||
}
|
||||
|
||||
private void 删除配置(ActionEvent e) {
|
||||
// TODO add your code here
|
||||
int selectedRow = table1.getSelectedRow();
|
||||
if (selectedRow != -1) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
||||
tableModel.removeRow(selectedRow);
|
||||
if(tableModel.getRowCount() > selectedRow)table1.setRowSelectionInterval(selectedRow, selectedRow);
|
||||
}
|
||||
}
|
||||
|
||||
private void 保存配置(ActionEvent e) {
|
||||
|
||||
List<ZLConfig> Buf = new ArrayList<>();
|
||||
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
||||
int rowCount = tableModel.getRowCount();
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
|
||||
Integer Count = (int) tableModel.getValueAt(i, 0);
|
||||
String NameFront = tableModel.getValueAt(i, 1).toString();
|
||||
String NameBack = tableModel.getValueAt(i, 1).toString();
|
||||
|
||||
ZLConfig buffer = new ZLConfig();
|
||||
buffer.setNum(Count);
|
||||
buffer.setName(NameFront);
|
||||
buffer.setName2(NameBack);
|
||||
Buf.add(buffer);
|
||||
}
|
||||
Start.zlConfigs = Buf;
|
||||
特殊控制台.setTwConfig();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
||||
scrollPane1 = new JScrollPane();
|
||||
table1 = new JTable();
|
||||
button21 = new JButton();
|
||||
button19 = new JButton();
|
||||
button25 = new JButton();
|
||||
|
||||
//======== this ========
|
||||
setLayout(null);
|
||||
|
||||
//======== scrollPane1 ========
|
||||
{
|
||||
|
||||
//---- table1 ----
|
||||
table1.setModel(new DefaultTableModel(
|
||||
new Object[][] {
|
||||
},
|
||||
new String[] {
|
||||
"\u8f6c\u751f\u6b21\u6570", "\u540d\u5b57\u524d\u7f00", "\u540d\u5b57\u540e\u7f00"
|
||||
}
|
||||
) {
|
||||
Class<?>[] columnTypes = new Class<?>[] {
|
||||
Integer.class, String.class, String.class
|
||||
};
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
return columnTypes[columnIndex];
|
||||
}
|
||||
});
|
||||
scrollPane1.setViewportView(table1);
|
||||
}
|
||||
add(scrollPane1);
|
||||
scrollPane1.setBounds(18, 10, scrollPane1.getPreferredSize().width, 595);
|
||||
|
||||
//---- button21 ----
|
||||
button21.setText("\u5220\u9664\u914d\u7f6e");
|
||||
button21.addActionListener(e -> 删除配置(e));
|
||||
add(button21);
|
||||
button21.setBounds(375, 620, 100, 35);
|
||||
|
||||
//---- button19 ----
|
||||
button19.setText("\u4fdd\u5b58\u914d\u7f6e");
|
||||
button19.addActionListener(e -> 保存配置(e));
|
||||
add(button19);
|
||||
button19.setBounds(20, 620, 100, 35);
|
||||
|
||||
//---- button25 ----
|
||||
button25.setText("\u65b0\u589e\u914d\u7f6e");
|
||||
button25.addActionListener(e -> 新增配置(e));
|
||||
add(button25);
|
||||
button25.setBounds(270, 620, 100, 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
|
||||
|
||||
DefaultTableModel tableModel = (DefaultTableModel)this.table1.getModel();
|
||||
// 创建一个自定义的单元格渲染器,用于右对齐字符串
|
||||
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
|
||||
rightRenderer.setHorizontalAlignment(JLabel.RIGHT);
|
||||
// 遍历表格的所有列,将字符串类型的列设置为右对齐
|
||||
for (int i = 0; i < table1.getColumnCount(); i++) {
|
||||
if (table1.getColumnClass(i) == String.class) {
|
||||
table1.getColumnModel().getColumn(i).setCellRenderer(rightRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
Start.zlConfigs.forEach((obj) -> {
|
||||
Integer Count = obj.getNum();
|
||||
String NameFront = obj.getName();
|
||||
String NameBack = obj.getName();
|
||||
|
||||
Object[] rowData = {Count, NameFront ,NameBack};
|
||||
tableModel.addRow(rowData);
|
||||
});
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
|
||||
private JScrollPane scrollPane1;
|
||||
private JTable table1;
|
||||
private JButton button21;
|
||||
private JButton button19;
|
||||
private JButton button25;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
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 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( "名字前缀" )
|
||||
add( "名字后缀" )
|
||||
}, new java.util.Vector {
|
||||
add( class java.lang.Integer )
|
||||
add( class java.lang.String )
|
||||
add( class java.lang.String )
|
||||
}, new java.util.Vector {
|
||||
add( null )
|
||||
add( null )
|
||||
add( null )
|
||||
}, new java.util.Vector {
|
||||
add( null )
|
||||
add( null )
|
||||
add( null )
|
||||
} )
|
||||
} )
|
||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
||||
"x": 18
|
||||
"y": 10
|
||||
"height": 595
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button21"
|
||||
"text": "删除配置"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "删除配置", true ) )
|
||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
||||
"width": 100
|
||||
"height": 35
|
||||
"x": 375
|
||||
"y": 620
|
||||
} )
|
||||
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 ) {
|
||||
"width": 100
|
||||
"height": 35
|
||||
"x": 20
|
||||
"y": 620
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button25"
|
||||
"text": "新增配置"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增配置", true ) )
|
||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
||||
"width": 100
|
||||
"height": 35
|
||||
"x": 270
|
||||
"y": 620
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 1570, 670 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
|
@ -7,17 +7,20 @@ public class UI_LenheartUI {
|
|||
private JPanel 物品回收页面;
|
||||
private JPanel 伤害控制页面;
|
||||
private JPanel 爆率控制页面;
|
||||
private JPanel 战力控制页面;
|
||||
private JPanel 爆物管理页面;
|
||||
|
||||
public UI_LenheartUI(JTabbedPane mainComponent) {
|
||||
物品回收页面 = new ItemRecovery();
|
||||
伤害控制页面 = new DamageControl();
|
||||
爆率控制页面 = new DropControl();
|
||||
战力控制页面 = new FightControl();
|
||||
爆物管理页面 = new ExplosiveControl();
|
||||
|
||||
mainComponent.addTab("物品回收设置", 物品回收页面);
|
||||
mainComponent.addTab("伤害控制设置", 伤害控制页面);
|
||||
mainComponent.addTab("爆率 & 鞭尸控制设置", 爆率控制页面);
|
||||
mainComponent.addTab("战力控制设置", 战力控制页面);
|
||||
mainComponent.addTab("爆物管理设置", 爆物管理页面);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue