当前位置: 首页>>代码示例>>Java>>正文


Java DefaultTableModel.insertRow方法代码示例

本文整理汇总了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()});
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TimeComponentPanel.java

示例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());
    }

}
 
开发者ID:wesleyreis1808,项目名称:projetomcdonalds,代码行数:21,代码来源:ControlerCadastroLanche.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:VariableFormatterEditPanel.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:VariableFormatterEditPanel.java

示例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();
    }
 
开发者ID:wesleyreis1808,项目名称:projetomcdonalds,代码行数:30,代码来源:ControlerAlteracaoLanche.java

示例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(),});
    }
}
 
开发者ID:wesleyreis1808,项目名称:projetomcdonalds,代码行数:12,代码来源:ControlerCadastroBebidas.java

示例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"
        });
    }

}
 
开发者ID:wesleyreis1808,项目名称:projetomcdonalds,代码行数:15,代码来源:ControlerCadastroFuncionario.java

示例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(","));
    }
}
 
开发者ID:NVIvanov,项目名称:jrbuilder,代码行数:34,代码来源:TableTransferTable.java


注:本文中的javax.swing.table.DefaultTableModel.insertRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。