本文整理汇总了Java中javax.swing.table.DefaultTableModel.insertRow方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableModel.insertRow方法的具体用法?Java DefaultTableModel.insertRow怎么用?Java DefaultTableModel.insertRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.table.DefaultTableModel
的用法示例。
在下文中一共展示了DefaultTableModel.insertRow方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeRow
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void changeRow(Object fo, String key) {
Integer row = key2RowNumber.get(key);
DefaultTableModel model = (DefaultTableModel) times.getModel();
if (row != null) {
model.removeRow(row);
}
TimesCollectorPeer.Description desc = TimesCollectorPeer.getDefault().getDescription(fo, key);
if (desc == null) {
return ;
}
if (row == null) {
key2RowNumber.put(key, row = model.getRowCount());
}
model.insertRow(row, new Object[] {desc.getMessage(), desc.getTime()});
}
示例2: preencheTabela
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
@Override
public void preencheTabela() {
dtm = (DefaultTableModel) this.cadastroLanche.getjTable1().getModel();
if (this.lanches != null) {
for (Lanche lan : lanches) {
dtm.insertRow(dtm.getRowCount(), new Object[]{
lan.getNome(),
lan.getPreco()
});
}
}
this.cadastroLanche.getLista_ingredientes().setModel(dlmIng);
this.cadastroLanche.getLista_lanche().setModel(dlmLan);
for (int i = 0; i < this.ingredientes.size(); i++) {
dlmIng.add(i, this.ingredientes.get(i).getNome());
}
}
示例3: moveUpVarButtonActionPerformed
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void moveUpVarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveUpVarButtonActionPerformed
int index = childrenVariablesTable.getSelectedRow();
if (index <= 0) return ;
DefaultTableModel model = (DefaultTableModel) childrenVariablesTable.getModel();
Object[] row = new Object[] { model.getValueAt(index, 0), model.getValueAt(index, 1) };
model.removeRow(index);
model.insertRow(index - 1, row);
childrenVariablesTable.getSelectionModel().setSelectionInterval(index - 1, index - 1);
}
示例4: moveDownVarButtonActionPerformed
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void moveDownVarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveDownVarButtonActionPerformed
int index = childrenVariablesTable.getSelectedRow();
if (index < 0) return ;
DefaultTableModel model = (DefaultTableModel) childrenVariablesTable.getModel();
if (index >= (model.getRowCount() - 1)) return ;
Object[] row = new Object[] { model.getValueAt(index, 0), model.getValueAt(index, 1) };
model.removeRow(index);
model.insertRow(index + 1, row);
childrenVariablesTable.getSelectionModel().setSelectionInterval(index + 1, index + 1);
}
示例5: updateTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void updateTable(ArrayList<PersonalInfo> pi1)
{
model = (DefaultTableModel)updateEmployeeTable.getModel();
model.setRowCount(0);
for(int i = 0; i < pi1.size(); i++){
model.insertRow(model.getRowCount(), new Object[]{pi1.get(i).getId(),pi1.get(i).getName(),
pi1.get(i).getPhone(), pi1.get(i).getAddress(), pi1.get(i).getCnic(),
pi1.get(i).geteName(), pi1.get(i).getePhone(), pi1.get(i).getDob(),
pi1.get(i).getEmail(), pi1.get(i).getPost(), pi1.get(i).getTiming(), pi1.get(i).getSalary()});
}
}
开发者ID:HamzaYasin1,项目名称:HR-Management-System-in-Java-using-swing-framework,代码行数:13,代码来源:UpdateEmployee.java
示例6: updateTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void updateTable(ArrayList<PersonalInfo> pi1)
{
model = (DefaultTableModel)updateEmployeeTable.getModel();
model.setRowCount(0);
for(int i = 0; i < pi1.size(); i++){
model.insertRow(model.getRowCount(), new Object[]{pi1.get(i).getId(),pi1.get(i).getName(),
pi1.get(i).getPhone(), pi1.get(i).getAddress(), pi1.get(i).getCnic(),
pi1.get(i).geteName(), pi1.get(i).getePhone(), pi1.get(i).getDob(),
pi1.get(i).getEmail(), pi1.get(i).getPost(), pi1.get(i).getTiming(),
pi1.get(i).getSalary()});
}
}
开发者ID:HamzaYasin1,项目名称:HR-Management-System-in-Java-using-swing-framework,代码行数:14,代码来源:SearchEmployee.java
示例7: adicionaTabela
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void adicionaTabela(Produtos produ) {
DecimalFormat df = new DecimalFormat("0.00");
DefaultTableModel dtm = (DefaultTableModel) this.telaVenda.getTbl_Carrinho().getModel();
if (produ instanceof Lanche) {
String op2 = produ.getModificacao();
// String op2 = (((AlteracaoLanche) alteracao).isModificacao()) ? "Não" : "Sim";
// ((Lanche) produ).setModificacao(op2);
dtm.insertRow(dtm.getRowCount(), new Object[]{
produ.getNome(),
((float) produ.getPreco()),
((float) ((Lanche) produ).getAdicional()),
op2
});
this.telaVenda.getLbl_ValorCompra().setText(df.format(calculaTotal()));
} else if (produ instanceof Bebidas) {
dtm.insertRow(dtm.getRowCount(), new Object[]{
produ.getNome(),
produ.getPreco(),
0,
"Não"
});
this.telaVenda.getLbl_ValorCompra().setText(df.format(calculaTotal()));
}
// mostrarProdutos();
}
示例8: preencheTabela
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
@Override
public void preencheTabela() {
dtm = (DefaultTableModel) this.cadastroBebida.getjTable1().getModel();
for (Bebidas bebi : bebidas) {
dtm.insertRow(dtm.getRowCount(), new Object[]{
bebi.getNome(),
bebi.getPreco(),
bebi.getTamanho(),});
}
}
示例9: preencheTabela
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
@Override
public void preencheTabela() {
dtm = (DefaultTableModel) this.cadastroFuncionario.getjTable1().getModel();
for (Funcionarios func : funcionarios) {
dtm.insertRow(dtm.getRowCount(), new Object[]{
func.getNome(),
func.getCpf(),
func.getTelefone(),
(func.getNivel_acesso() == 1) ? "Vendedor" : "Gerente"
});
}
}
示例10: importString
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
protected void importString(JComponent c, String str) {
JTable target = (JTable) c;
DefaultTableModel model = (DefaultTableModel) target.getModel();
int index = target.getSelectedRow();
//Prevent the user from dropping data back on itself.
//For example, if the user is moving rows #4,#5,#6 and #7 and
//attempts to insert the rows after row #5, this would
//be problematic when removing the original rows.
//So this is not allowed.
if (rows != null && index >= rows[0] - 1
&& index <= rows[rows.length - 1]) {
rows = null;
return;
}
int max = model.getRowCount();
if (index < 0) {
index = max;
} else {
index++;
if (index > max) {
index = max;
}
}
addIndex = index;
String[] values = str.split("\n");
addCount = values.length;
int colCount = target.getColumnCount();
for (int i = 0; i < values.length && i < colCount; i++) {
model.insertRow(index++, values[i].split(","));
}
}