物品回收的UI更新
This commit is contained in:
parent
1a457f3bfa
commit
8a7b1ac9ae
|
|
@ -31,7 +31,7 @@ public class ItemRecovery extends JPanel {
|
|||
if (selectedRow != -1) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel) ItemTable.getModel();
|
||||
tableModel.removeRow(selectedRow);
|
||||
ItemTable.setRowSelectionInterval(selectedRow, selectedRow);
|
||||
if(tableModel.getRowCount() > selectedRow)ItemTable.setRowSelectionInterval(selectedRow, selectedRow);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -43,12 +43,14 @@ public class ItemRecovery extends JPanel {
|
|||
Map<String, List<Integer>> ConfigItemJson = new HashMap<>();
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
String Key = tableModel.getValueAt(i, 0).toString();
|
||||
Integer A = (int) tableModel.getValueAt(i, 1);
|
||||
Integer B = (int) tableModel.getValueAt(i, 2);
|
||||
Integer A = (int) tableModel.getValueAt(i, 2);
|
||||
Integer B = (int) tableModel.getValueAt(i, 3);
|
||||
Integer C = (int) tableModel.getValueAt(i, 1);
|
||||
|
||||
List<Integer> Data = new ArrayList<>();
|
||||
Data.add(B);
|
||||
Data.add(A);
|
||||
Data.add(C);
|
||||
ConfigItemJson.put(Key,Data);
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +60,7 @@ public class ItemRecovery extends JPanel {
|
|||
|
||||
private void 新增按钮(ActionEvent e) {
|
||||
DefaultTableModel tableModel = (DefaultTableModel) ItemTable.getModel();
|
||||
Object[] rowData = {0, 0, 0};
|
||||
Object[] rowData = {0, 0, 0,0};
|
||||
tableModel.addRow(rowData);
|
||||
}
|
||||
|
||||
|
|
@ -81,26 +83,17 @@ public class ItemRecovery extends JPanel {
|
|||
new Object[][] {
|
||||
},
|
||||
new String[] {
|
||||
"\u5151\u6362\u7269\u54c1\u4ee3\u7801", "\u6240\u9700\u7269\u54c1\u4ee3\u7801", "\u6240\u9700\u7269\u54c1\u6570\u91cf"
|
||||
"\u5151\u6362\u7269\u54c1\u4ee3\u7801", "\u7269\u54c1\u5151\u6362\u6570\u91cf", "\u6240\u9700\u7269\u54c1\u4ee3\u7801", "\u6240\u9700\u7269\u54c1\u6570\u91cf"
|
||||
}
|
||||
) {
|
||||
Class<?>[] columnTypes = new Class<?>[] {
|
||||
Integer.class, Integer.class, Integer.class
|
||||
Integer.class, Integer.class, Integer.class, Integer.class
|
||||
};
|
||||
@Override
|
||||
public Class<?> getColumnClass(int columnIndex) {
|
||||
return columnTypes[columnIndex];
|
||||
}
|
||||
});
|
||||
{
|
||||
TableColumnModel cm = ItemTable.getColumnModel();
|
||||
cm.getColumn(0).setMinWidth(50);
|
||||
cm.getColumn(0).setMaxWidth(150);
|
||||
cm.getColumn(1).setMinWidth(50);
|
||||
cm.getColumn(1).setMaxWidth(150);
|
||||
cm.getColumn(2).setMinWidth(50);
|
||||
cm.getColumn(2).setMaxWidth(150);
|
||||
}
|
||||
ItemTable.setAutoCreateRowSorter(true);
|
||||
ItemTable.setBorder(null);
|
||||
scrollPane1.setViewportView(ItemTable);
|
||||
|
|
@ -136,9 +129,10 @@ public class ItemRecovery extends JPanel {
|
|||
Integer ItemId = Integer.valueOf(k);
|
||||
Integer NeedItemId = v.get(1);
|
||||
Integer NeedCount = v.get(0);
|
||||
Integer GiveCount = v.get(2);
|
||||
|
||||
DefaultTableModel tableModel = (DefaultTableModel) ItemTable.getModel();
|
||||
Object[] rowData = {ItemId, NeedItemId, NeedCount};
|
||||
Object[] rowData = {ItemId, GiveCount ,NeedItemId, NeedCount};
|
||||
tableModel.addRow(rowData);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -13,20 +13,24 @@ new FormModel {
|
|||
name: "ItemTable"
|
||||
"model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector, new java.util.Vector {
|
||||
add( "兑换物品代码" )
|
||||
add( "物品兑换数量" )
|
||||
add( "所需物品代码" )
|
||||
add( "所需物品数量" )
|
||||
}, new java.util.Vector {
|
||||
add( class java.lang.Integer )
|
||||
add( class java.lang.Integer )
|
||||
add( class java.lang.Integer )
|
||||
add( class java.lang.Integer )
|
||||
}, new java.util.Vector {
|
||||
add( null )
|
||||
add( null )
|
||||
add( null )
|
||||
add( null )
|
||||
}, new java.util.Vector {
|
||||
add( new com.jformdesigner.model.SwingTableColumn( null, 0, 50, 150, true ) )
|
||||
add( new com.jformdesigner.model.SwingTableColumn( null, 0, 50, 150, true ) )
|
||||
add( new com.jformdesigner.model.SwingTableColumn( null, 0, 50, 150, true ) )
|
||||
add( null )
|
||||
add( null )
|
||||
add( null )
|
||||
add( null )
|
||||
} )
|
||||
"autoCreateRowSorter": true
|
||||
"border": sfield com.jformdesigner.model.FormObject NULL_VALUE
|
||||
|
|
|
|||
Loading…
Reference in New Issue