Example usage for javax.swing.table DefaultTableModel setRowCount

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

Introduction

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

Prototype

public void setRowCount(int rowCount) 

Source Link

Document

Sets the number of rows in the model.

Usage

From source file:UserInterface.FinanceRole.OverallTransactionJPanel.java

private void populateTransactionTable() {

    DefaultTableModel dtm = (DefaultTableModel) transactionJTable.getModel();
    dtm.setRowCount(0);

    if ((objOrganization instanceof WorldAdminOrganization)
            || (objOrganization instanceof FinanceOrganization)) {

        objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount();
        virBalJTextField.setText(//  w  w  w. j a  va  2  s.  c o  m
                "$ " + objWorldEnterprise.getObjTransactionDirectory().getAvailableVirtualBalance().toString());
        virSpentJTextField1.setText(
                "$ " + objWorldEnterprise.getObjTransactionDirectory().getTotalVirtualDebitAmount().toString());
        realBalJTextField.setText(
                "$ " + objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance().toString());
        realSpentJTextField.setText(
                "$ " + objWorldEnterprise.getObjTransactionDirectory().getTotalRealDebitAmount().toString());

        for (Transaction objTransaction : objWorldEnterprise.getObjTransactionDirectory()
                .getTransactionList()) {

            Object row[] = new Object[9];
            row[0] = objTransaction;
            row[1] = objTransaction.getTransactionSource();
            row[2] = (objTransaction.getObjUserAccountSource() == null) ? ("N/A")
                    : (objTransaction.getObjUserAccountSource().getObjPerson());
            row[3] = objTransaction.getTransactionDestination();
            row[4] = (objTransaction.getObjUserAccountDestination() == null) ? ("N/A")
                    : (objTransaction.getObjUserAccountDestination().getObjPerson());
            row[5] = objTransaction.getTransactionType();
            row[6] = objTransaction.getTransactionMode();
            row[7] = "$ " + String.valueOf(objTransaction.getTransactionBDAmount());
            row[8] = objTransaction.getTransactionDateToDisplay();

            dtm.addRow(row);
        }
    }

    if (objOrganization instanceof RegisteredSiteAdminOrganization) {

        objRegisteredSiteEnterprise.getObjTransactionDirectory().updateTransactionAccount();
        virBalJTextField.setText("$ " + objRegisteredSiteEnterprise.getObjTransactionDirectory()
                .getAvailableVirtualBalance().toString());
        virSpentJTextField1.setText("$ " + objRegisteredSiteEnterprise.getObjTransactionDirectory()
                .getTotalVirtualDebitAmount().toString());
        realBalJTextField.setText("$ " + objRegisteredSiteEnterprise.getObjTransactionDirectory()
                .getAvailableRealBalance().toString());
        realSpentJTextField.setText("$ " + objRegisteredSiteEnterprise.getObjTransactionDirectory()
                .getTotalRealDebitAmount().toString());

        for (Transaction objTransaction : objRegisteredSiteEnterprise.getObjTransactionDirectory()
                .getTransactionList()) {

            Object row[] = new Object[9];
            row[0] = objTransaction;
            row[1] = objTransaction.getTransactionSource();
            row[2] = (objTransaction.getObjUserAccountSource() == null) ? ("N/A")
                    : (objTransaction.getObjUserAccountSource().getObjPerson());
            row[3] = objTransaction.getTransactionDestination();
            row[4] = (objTransaction.getObjUserAccountDestination() == null) ? ("N/A")
                    : (objTransaction.getObjUserAccountDestination().getObjPerson());
            row[5] = objTransaction.getTransactionType();
            row[6] = objTransaction.getTransactionMode();
            row[7] = "$ " + String.valueOf(objTransaction.getTransactionBDAmount());
            row[8] = objTransaction.getTransactionDateToDisplay();

            dtm.addRow(row);
        }
    }
}

From source file:UserInterface.PatientRole.ManageMyVitalSignsAndFitnessRecordJPanel.java

private void populateTable() {
    DefaultTableModel model = (DefaultTableModel) viewVitalSignsJTable1.getModel();
    model.setRowCount(0);

    DoctorOrganization doctorOrganization = null;
    for (Organization o : enterprise.getOrganizationDirectory().getOrganizationList()) {
        if (o instanceof DoctorOrganization) {
            DoctorOrganization dO = (DoctorOrganization) o;
            doctorOrganization = dO;/* w  w w.j  a va  2s.  com*/
            break;
        }
    }

    for (WorkRequest request : doctorOrganization.getWorkQueue().getWorkRequestList()) {
        if (request != null) {
            PatientDoctorWorkRequest patientDoctorWorkRequest = (PatientDoctorWorkRequest) request;
            Record r = patientDoctorWorkRequest.getRecord();
            Object[] row = new Object[5];
            row[0] = r;
            row[1] = r.getNormalOrNot();
            row[2] = r.getTotalTime();
            row[3] = r.getNeedMoreExcerciseOrNot();
            String respondStatus = patientDoctorWorkRequest.getRespondStatus();
            row[4] = respondStatus == null ? "Waiting" : respondStatus;

            model.addRow(row);

        }

    }
}

From source file:edu.ucla.stat.SOCR.chart.util.MixtureEMExperiment.java

protected void resetRTableRows(int n) {
    DefaultTableModel tModel_results = (javax.swing.table.DefaultTableModel) resultsTable.getModel();
    tModel_results.setRowCount(n);
    resultsTable.setModel(tModel_results);
}

From source file:UserInterface.ViewPersonDetails.java

public void populateTable() {
    DefaultTableModel dtm = (DefaultTableModel) tblvitalSign.getModel();
    dtm.setRowCount(0);
    for (VitalSign s : p.getPatient().getVitalsignHistory().getVitalSignHistory()) {
        Object row[] = new Object[6];
        row[0] = s;// w ww.  j a va2  s  . c  o m
        row[1] = s.getRespiratoryrate();
        row[2] = s.getHeartrate();
        row[3] = s.getBloodpressure();
        row[4] = s.getWeight();

        row[5] = s.getStatus();

        dtm.addRow(row);
    }
}

From source file:com.neu.css.view.ViewPatientDetailsJPanel.java

/**
 * populate the table with the vital sign history object
 *//*  w  w  w  . j  av  a2s .  c  o  m*/
private void populateTable() {
    DefaultTableModel defaultTableModel = (DefaultTableModel) jTable1.getModel();
    defaultTableModel.setRowCount(0);
    VitalSignHistory vitalSignHistory = patient.getVitalSignHistory();
    if (null != vitalSignHistory) {
        ArrayList<VitalSign> vitalSignList = vitalSignHistory.getVitalSignList();
        for (VitalSign vitalSign : vitalSignList) {
            Object[] rows = new Object[2];
            rows[0] = vitalSign;
            rows[1] = (String) checkSymtoms(vitalSign);
            defaultTableModel.addRow(rows);
        }
    }
}

From source file:stockit.ClientFrame.java

private void setUpTable() {
    try {/*from   ww w .j  a  v a 2  s. c om*/
        DBConnection dbcon = new DBConnection();
        dbcon.establishConnection();
        Statement stmt = dbcon.con.createStatement();
        ResultSet rs = stmt.executeQuery(
                "SELECT stock.stockID, company.Name, stock_sector.Sector, stock_daily_performance.Currency, stock_daily_performance.High, stock_daily_performance.Low, stock_daily_performance.Closing_Price, has_positions.Qty, (stock_daily_performance.Opening_Price - stock_daily_performance.Closing_Price) AS Today_Change, ((stock_daily_performance.Opening_Price - stock_daily_performance.Closing_Price) * has_positions.Qty) AS Profit\n"
                        + "FROM stock, stock_sector, stock_daily_performance, has_positions, account, company, client\n"
                        + "WHERE client.Name = '" + name + "'"
                        + "AND client.Client_SSN = account.Client_SSN AND account.Account_ID = has_positions.Account_ID AND stock_daily_performance.StockID = has_positions.Stock_ID AND stock.StockID = has_positions.Stock_ID AND stock_sector.StockID = has_positions.Stock_ID AND company.StockID = stock.StockID AND Date IN\n"
                        + "( Select * from \n" + "(\n" + "SELECT max(Date) \n"
                        + "FROM stock_daily_performance, stock\n"
                        + "where stock_daily_performance.StockID=stock.StockID\n" + "group by stock.StockID\n"
                        + "ORDER BY Date\n" + ") temp_table)");
        DefaultTableModel model = (DefaultTableModel) StockInfoTable.getModel();
        model.setRowCount(0);
        while (rs.next()) {
            //System.out.println(rs.getString("stockID") + "\t" + rs.getString("StockName") + "\t" + rs.getString("Sector") + "\t" + rs.getString("Currency") + "\t" + rs.getString("Closing_Price") + "\t" + rs.getString("Qty") + rs.getString("Today_Change"));
            model.addRow(new Object[] { rs.getString("stockID"), rs.getString("Name"), rs.getString("Sector"),
                    rs.getString("Qty"), rs.getString("High"), rs.getString("Low"),
                    rs.getString("Closing_Price"), rs.getString("Today_Change"), rs.getString("Currency"),
                    rs.getString("Profit") });
        }
        dbcon.con.close();
    } catch (Exception ex) {
        System.out.println(ex.toString());
    }
}

From source file:userinterface.HealthAnalystRole.ViewReportJPanel.java

public void populateEffectsonBodyTable(Device d) {
    //device = (Device) tblHealthTable.getValueAt(selectedRow, 0);
    //tblHealthTable.setValueAt(device,selectedRow,0);
    value1.setText(d.getIMEINo());/*  www .j  ava 2 s  .co  m*/
    DefaultTableModel mod = (DefaultTableModel) tblBodyEffects.getModel();
    mod.setRowCount(0);
    for (EffectsOnBody b : d.getEffectsOnBodyList().getEffectsOnBodyList()) {
        Object row[] = new Object[3];
        row[0] = b;
        row[1] = b.getDiseaseType();
        //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] = b.getEffectsOnOrgans();
        // row[6] = b.getDiseaseType();
        mod.addRow(row);
    }

}

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);
        for (Device d : organization.getDeviceDirectory().getDeviceList()) {
            //if(d.getEffectsOnBodyList().getEffectsOnBodyList().isEmpty()) {

            Object row[] = new Object[7];
            row[0] = d;//from   www  .  ja  v  a2s.c om
            //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:Import.pnl_import_vcf.java

public void setMapTable(JTable table, DefaultTableModel model, String[] selectedFamilies,
        String[] selectedTableFamilies) {
    model.setRowCount(0);
    model.addColumn("Import Column");
    model.addColumn("Map to");
    TableColumn sportColumn = table.getColumnModel().getColumn(1);
    JComboBox comboBox = new JComboBox();
    for (String a : selectedFamilies) {
        comboBox.addItem(a);//from   www  .j av a 2s . co m
    }
    sportColumn.setCellEditor(new DefaultCellEditor(comboBox));
    for (String b : selectedTableFamilies) {
        String[] tmp = new String[1];
        tmp[0] = b;
        model.addRow(tmp);
    }
}

From source file:UserInterface.DonorRole.DonorWorkAreaJPanel.java

private void populateDonationTable() {

    DefaultTableModel dtm = (DefaultTableModel) donationJTable.getModel();
    dtm.setRowCount(0);

    for (Transaction objTransaction : objPerson.getObjDonorTransactionDirectory().getTransactionList()) {

        Object row[] = new Object[3];
        row[0] = objTransaction;/* www. j ava2s . c o  m*/
        row[1] = objTransaction.getTransactionDateToDisplay();
        row[2] = "$ " + String.valueOf(objTransaction.getTransactionBDAmount());
        dtm.addRow(row);
    }
}