Example usage for javax.swing.table DefaultTableModel addRow

List of usage examples for javax.swing.table DefaultTableModel addRow

Introduction

In this page you can find the example usage for javax.swing.table DefaultTableModel addRow.

Prototype

public void addRow(Object[] rowData) 

Source Link

Document

Adds a row to the end of the model.

Usage

From source file:userinterface.MetalRecyclingServiceRole.MetalRecyclingServiceJPanel.java

private void jRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRefreshActionPerformed
    DefaultTableModel model = (DefaultTableModel) jMetalRecycling.getModel();

    model.setRowCount(0);//from   w  w  w. j  a va2 s .c o m
    for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) {
        Object[] row = new Object[8];
        row[0] = request;
        row[1] = ((MetalRecyclingWorkRequest) request).getReceiver();
        row[2] = ((MetalRecyclingWorkRequest) request).getSegregatedMetal();

        row[3] = ((MetalRecyclingWorkRequest) request).getQuantityProduced();
        row[4] = ((MetalRecyclingWorkRequest) request).getMoneyEarned();
        row[5] = ((MetalRecyclingWorkRequest) request).getmTemperature();
        row[6] = ((MetalRecyclingWorkRequest) request).getmTime();
        row[7] = ((MetalRecyclingWorkRequest) request).getSentTo();

        model.addRow(row);
    }

    jTotal.setEnabled(true);
}

From source file:com.alvermont.terraj.stargen.ui.SystemFrame.java

/**
 * Fill in the details on the overview panel
 *///w  ww .j a  v a2s .c  o  m
public void populateOverview() {
    DefaultTableModel dtm = (DefaultTableModel) overviewTable.getModel();

    for (Planet p : this.planets) {
        Object[] row = new Object[6];

        row[0] = new Integer(p.getNumber());
        row[1] = p.getType().getPrintText(p.getType());
        row[2] = String.format("%.3f AU", p.getA());
        row[3] = String.format("%.3f EM", p.getMass() * Constants.SUN_MASS_IN_EARTH_MASSES);
        row[4] = String.format("%.3f ER", p.getRadius() / Constants.KM_EARTH_RADIUS);
        row[5] = new JButton("Details ...");

        dtm.addRow(row);
    }

    // Disable auto resizing
    overviewTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    // Set the first visible column to 100 pixels wide
    TableColumn col = overviewTable.getColumnModel().getColumn(0);
    int width = 50;
    col.setPreferredWidth(width);
    overviewTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
}

From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java

private void populateTab3Table() {
    int rowCount = tab3jTable.getRowCount();
    DefaultTableModel dtm = (DefaultTableModel) tab3jTable.getModel();

    //delete all the previous rows
    for (int i = rowCount - 1; i >= 0; i--) {
        dtm.removeRow(i);//from   w w  w .  j  ava  2s  .co m
    }

    for (MedicalDevice md : inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList()) {
        Object[] row = new Object[4];
        row[0] = md;
        row[1] = md.getDeviceCatagory();
        row[2] = md.getAvailableQuantity();
        row[3] = md.getServiceInterval();
        dtm.addRow(row);
    }

}

From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java

private void populateTab4Table() {
    int rowCount = tab4jTable.getRowCount();
    DefaultTableModel dtm = (DefaultTableModel) tab4jTable.getModel();

    //delete all the previous rows
    for (int i = rowCount - 1; i >= 0; i--) {
        dtm.removeRow(i);//from w w  w.  j av  a 2  s .  c  o m
    }

    for (MedicalDevice md : inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList()) {
        Object[] row = new Object[4];
        row[0] = md;
        row[1] = md.getDeviceCatagory();
        row[2] = md.getAvailableQuantity();
        row[3] = md.getServiceInterval();
        dtm.addRow(row);
    }

}

From source file:UserInterfaces.HAdministration.DeviceReportJPanel.java

private void populateTbale() {

    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
    model.setRowCount(0);//from  w w  w  .ja v a 2 s.  c o m

    for (WorkRequest w : enterprise.getWorkQueue().getWorkRequestList()) {
        if (w.getLevel2().equals(ErrorUtil.DEVICE_OR_MEDICAL)) {
            Object[] row = new Object[4];
            row[0] = w.getReportdate();
            row[1] = w.getDevicecause();
            row[2] = w.getDeviceerror();
            row[3] = w.getSource();
            model.addRow(row);
        }
    }

}

From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java

private void populateWarehouseDevicesTable() {
    int rowCount = warehouseDevicesjTable.getRowCount();
    DefaultTableModel dtm = (DefaultTableModel) warehouseDevicesjTable.getModel();

    //delete all the previous rows
    for (int i = rowCount - 1; i >= 0; i--) {
        dtm.removeRow(i);//from  www  . j a  v a 2 s  .c o  m
    }

    for (MedicalDevice md : inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList()) {
        Object[] row = new Object[4];
        row[0] = md;
        row[1] = md.getDeviceCatagory();
        row[2] = md.getAvailableQuantity();
        row[3] = md.getServiceInterval();
        dtm.addRow(row);
    }
}

From source file:userinterface.PlasticRecyclingServiceRole.PlasticRecyclingJPanel.java

private void jRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRefreshActionPerformed
    DefaultTableModel model = (DefaultTableModel) jPlasticRecycling.getModel();

    model.setRowCount(0);/*from w  w w .j  a va  2  s .  com*/
    for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) {
        Object[] row = new Object[8];
        row[0] = request;
        row[1] = ((PlasticRecyclingWorkRequest) request).getReceiver();
        row[2] = ((PlasticRecyclingWorkRequest) request).getSegregatedPlastic();

        row[3] = ((PlasticRecyclingWorkRequest) request).getNumberOfItemsProduced();
        row[4] = ((PlasticRecyclingWorkRequest) request).getpMoneyEarned();
        row[5] = ((PlasticRecyclingWorkRequest) request).getpTemperature();
        row[6] = ((PlasticRecyclingWorkRequest) request).getpTime();
        row[7] = ((PlasticRecyclingWorkRequest) request).getSentTo();

        model.addRow(row);
    }
    jTotal.setEnabled(true);
}

From source file:userinterface.HealthAnalystRole.ViewReportJPanel.java

public void populateTable() {
    //DefaultTableModel model = (DefaultTableModel) tblHealthTable.getModel();

    //model.setRowCount(0);
    if (organization.getDeviceDirectory() != null) {
        DefaultTableModel model = (DefaultTableModel) tblHealthTable.getModel();

        model.setRowCount(0);//from  w w w . j av  a 2s  .  c o m
        for (Device d : organization.getDeviceDirectory().getDeviceList()) {
            //if(d.getEffectsOnBodyList().getEffectsOnBodyList().isEmpty()) {

            Object row[] = new Object[7];
            row[0] = d;
            //row[1] = d.getModelNo();
            //row[2] = d.getCallEndTime();
            row[1] = d.getAvgSAR();
            row[2] = d.getMaxSAR();
            row[3] = d.getValueRF();
            row[4] = d.getCallEndTime();
            //row[5] = "";
            //row[6] = "";
            model.addRow(row);
        }
    } else {
        JOptionPane.showMessageDialog(null, "No Device Found");
    }
}

From source file:main.java.edu.isistan.genCom.gui.Principal.java

/**
  * Registra la generacin en el historial
  *//*from   ww w.  ja va  2 s  . co m*/
 private void cargarHistorial() {
     ConfiguracionAG conf = generacionCargada.getConfiguracion();

     // Carga la tabla de historial
     DefaultTableModel dtmLog = (DefaultTableModel) tbHistorial.getModel();

     dtmLog.addRow(new String[] {
             DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG)
                     .format(generacionCargada.getFecha()),
             conf.getCruce().toString(), conf.getMutacion().toString(), conf.getSeleccion().toString(),
             conf.getModelo().toString(), String.valueOf(generacionCargada.getEjecuciones().size()),
             String.valueOf(conf.getCorte()), generacionCargada.getConfiguracion().getFitness().toString(),
             String.valueOf(generacionCargada.getFitnessPromedio()),
             String.valueOf(generacionCargada.getFitnessDesviacion()) });
 }

From source file:userinterface.PatientRole.PatientWorkAreaJPanel.java

public void populateWorkReqTable() {
    DefaultTableModel model = (DefaultTableModel) workRequestJTable.getModel();

    model.setRowCount(0);/*  w w w  . j av  a 2s.c o m*/
    for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) {
        if (request instanceof GetDiagnosisWorkRequest) {
            Object[] row = new Object[4];
            row[0] = request.getMessage();
            row[1] = request.getReceiver();
            row[2] = request.getStatus();
            String result = ((GetDiagnosisWorkRequest) request).getTestResult();
            row[3] = result == null ? "Waiting" : result;

            model.addRow(row);
        }
    }
}