no message
This commit is contained in:
parent
824a68b345
commit
cbec4a2c16
|
|
@ -5,10 +5,13 @@
|
||||||
package gui.UI_LenheartUI;
|
package gui.UI_LenheartUI;
|
||||||
|
|
||||||
import gui.Start;
|
import gui.Start;
|
||||||
|
import gui.tw.BlConfig;
|
||||||
import gui.特殊控制台;
|
import gui.特殊控制台;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.table.*;
|
import javax.swing.table.*;
|
||||||
|
|
||||||
|
|
@ -24,9 +27,48 @@ public class DropControl extends JPanel {
|
||||||
private void 保存配置(ActionEvent e) {
|
private void 保存配置(ActionEvent e) {
|
||||||
// TODO add your code here
|
// TODO add your code here
|
||||||
|
|
||||||
|
Start.blkg = this.toggleButton1.isSelected() ? 1 : 0;
|
||||||
|
Start.bldj = this.toggleButton2.isSelected() ? 1 : 0;
|
||||||
|
|
||||||
|
List<BlConfig> Buf = new ArrayList<>();
|
||||||
|
DefaultTableModel tableModel = (DefaultTableModel) table1.getModel();
|
||||||
|
int rowCount = tableModel.getRowCount();
|
||||||
|
for (int i = 0; i < rowCount; i++) {
|
||||||
|
|
||||||
|
Integer ItemId = (int) tableModel.getValueAt(i, 0);
|
||||||
|
Integer GoldRate = (int) tableModel.getValueAt(i, 1);
|
||||||
|
Integer ItemRate = (int) tableModel.getValueAt(i, 2);
|
||||||
|
String Time = tableModel.getValueAt(i, 3) + "-" + tableModel.getValueAt(i, 4);
|
||||||
|
Integer IsStack = (int) tableModel.getValueAt(i, 5);
|
||||||
|
|
||||||
|
BlConfig buffer = new BlConfig();
|
||||||
|
buffer.setItem_id(ItemId);
|
||||||
|
buffer.setGold_rate(GoldRate);
|
||||||
|
buffer.setItem_rate(ItemRate);
|
||||||
|
buffer.setTime_range(Time);
|
||||||
|
buffer.setStackable(IsStack);
|
||||||
|
Buf.add(buffer);
|
||||||
|
}
|
||||||
|
Start.BLlist = Buf;
|
||||||
特殊控制台.setTwConfig();
|
特殊控制台.setTwConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 initComponents() {
|
private void initComponents() {
|
||||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @formatter:off
|
||||||
scrollPane1 = new JScrollPane();
|
scrollPane1 = new JScrollPane();
|
||||||
|
|
@ -36,6 +78,8 @@ public class DropControl extends JPanel {
|
||||||
label1 = new JLabel();
|
label1 = new JLabel();
|
||||||
label2 = new JLabel();
|
label2 = new JLabel();
|
||||||
button19 = new JButton();
|
button19 = new JButton();
|
||||||
|
button20 = new JButton();
|
||||||
|
button21 = new JButton();
|
||||||
|
|
||||||
//======== this ========
|
//======== this ========
|
||||||
setLayout(null);
|
setLayout(null);
|
||||||
|
|
@ -96,6 +140,18 @@ public class DropControl extends JPanel {
|
||||||
add(button19);
|
add(button19);
|
||||||
button19.setBounds(25, 645, 160, 35);
|
button19.setBounds(25, 645, 160, 35);
|
||||||
|
|
||||||
|
//---- button20 ----
|
||||||
|
button20.setText("\u65b0\u589e\u914d\u7f6e");
|
||||||
|
button20.addActionListener(e -> 新增配置(e));
|
||||||
|
add(button20);
|
||||||
|
button20.setBounds(825, 570, 160, 35);
|
||||||
|
|
||||||
|
//---- button21 ----
|
||||||
|
button21.setText("\u5220\u9664\u914d\u7f6e");
|
||||||
|
button21.addActionListener(e -> 删除配置(e));
|
||||||
|
add(button21);
|
||||||
|
button21.setBounds(990, 570, 160, 35);
|
||||||
|
|
||||||
{
|
{
|
||||||
// compute preferred size
|
// compute preferred size
|
||||||
Dimension preferredSize = new Dimension();
|
Dimension preferredSize = new Dimension();
|
||||||
|
|
@ -116,6 +172,18 @@ public class DropControl extends JPanel {
|
||||||
this.toggleButton1.setSelected(Start.blkg == 1 ? true : false);
|
this.toggleButton1.setSelected(Start.blkg == 1 ? true : false);
|
||||||
this.toggleButton2.setSelected(Start.bldj == 1 ? true : false);
|
this.toggleButton2.setSelected(Start.bldj == 1 ? true : false);
|
||||||
|
|
||||||
|
|
||||||
|
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.BLlist.forEach((obj) -> {
|
Start.BLlist.forEach((obj) -> {
|
||||||
Integer ItemId = obj.getItem_id();
|
Integer ItemId = obj.getItem_id();
|
||||||
Integer GoldRate = obj.getGold_rate();
|
Integer GoldRate = obj.getGold_rate();
|
||||||
|
|
@ -123,8 +191,8 @@ public class DropControl extends JPanel {
|
||||||
String Time = obj.getTime_range();
|
String Time = obj.getTime_range();
|
||||||
Integer IsStack = obj.getStackableNum();
|
Integer IsStack = obj.getStackableNum();
|
||||||
|
|
||||||
DefaultTableModel tableModel = (DefaultTableModel) ItemTable.getModel();
|
String[] split = Time.split("-");
|
||||||
Object[] rowData = {ItemId, GiveCount ,NeedItemId, NeedCount};
|
Object[] rowData = {ItemId, GoldRate ,ItemRate,split[0],split[1], IsStack};
|
||||||
tableModel.addRow(rowData);
|
tableModel.addRow(rowData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -137,5 +205,7 @@ public class DropControl extends JPanel {
|
||||||
private JLabel label1;
|
private JLabel label1;
|
||||||
private JLabel label2;
|
private JLabel label2;
|
||||||
private JButton button19;
|
private JButton button19;
|
||||||
|
private JButton button20;
|
||||||
|
private JButton button21;
|
||||||
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
// JFormDesigner - End of variables declaration //GEN-END:variables @formatter:on
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,26 @@ new FormModel {
|
||||||
"x": 25
|
"x": 25
|
||||||
"y": 645
|
"y": 645
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
|
name: "button20"
|
||||||
|
"text": "新增配置"
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "新增配置", true ) )
|
||||||
|
}, new FormLayoutConstraints( class com.jformdesigner.runtime.NullConstraints ) {
|
||||||
|
"width": 160
|
||||||
|
"height": 35
|
||||||
|
"x": 825
|
||||||
|
"y": 570
|
||||||
|
} )
|
||||||
|
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": 160
|
||||||
|
"height": 35
|
||||||
|
"x": 990
|
||||||
|
"y": 570
|
||||||
|
} )
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 0 )
|
"location": new java.awt.Point( 0, 0 )
|
||||||
"size": new java.awt.Dimension( 1585, 715 )
|
"size": new java.awt.Dimension( 1585, 715 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue