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:Main.java

public static void table_clean(JTable table) {
    DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
    tableModel.setRowCount(0);
}

From source file:Main.java

public static void LimpaTabela(JTable tabela) {
    DefaultTableModel apaga = new DefaultTableModel(new String[0][0], new String[0]);
    apaga.setRowCount(0);
    tabela.setModel(apaga);/*from  w  w  w  .j  av a 2 s. c o m*/
}

From source file:FindHullWindowLogic.java

static public void fullfilTableWithConvexHull(JTable jTableDest, ArrayList<Point2D> convexHull) {
    DefaultTableModel jTableDestModel = (DefaultTableModel) jTableDest.getModel();
    jTableDestModel.setRowCount(0);

    int i = 1;/*from  w w  w  .  j  a  v a  2  s. com*/
    for (Point2D onePoint : convexHull) {
        if (i != 1 && areTheSamePoints(onePoint, convexHull.get(0)))
            break;
        jTableDestModel.addRow(new Object[] { i + ".", onePoint.getX(), onePoint.getY() });
        i++;
    }

}

From source file:Gui.MainGuiBuilder.java

public static void PostTableUpdate() {

    DefaultTableModel postTabelModel = (DefaultTableModel) PostTable.getModel();

    listPost = pService.getPostList();/* w w w.j a  v  a 2s . c  o m*/

    postTabelModel.setRowCount(listPost.size());
    for (int i = 0; i < listPost.size(); i++) {

        PostTable.setValueAt(listPost.get(i).getId(), i, 0);
        PostTable.setValueAt(listPost.get(i).getTitre(), i, 1);
        PostTable.setValueAt(listPost.get(i).getText(), i, 2);
        PostTable.setValueAt(listPost.get(i).getDateCreation(), i, 3);
        PostTable.setValueAt(listPost.get(i).getGouvernorat(), i, 4);
        PostTable.setValueAt(listPost.get(i).getRubrique(), i, 5);
        PostTable.setValueAt(listPost.get(i).getNature(), i, 6);
        PostTable.setValueAt(listPost.get(i).getType(), i, 7);
        PostTable.setValueAt(listPost.get(i).getPrix(), i, 8);
        PostTable.setValueAt(listPost.get(i).getUserMail(), i, 9);
    }
}

From source file:cz.muni.fi.mushroomhunter.restclient.AllLocationSwingWorker.java

@Override
protected void done() {
    try {//from   w ww.  ja v  a2 s  .c o  m
        get();
    } catch (Exception e) {
        restClient.getlMessageLocations().setText("ERROR: server is unavailable.");
        return;
    }
    try {
        List<LocationDto> list = get();
        DefaultTableModel model = (DefaultTableModel) restClient.getTblLocation().getModel();
        model.setRowCount(0);
        for (LocationDto list1 : list) {
            RestClient.getLocationIDs().add(list1.getId());
            model.addRow(new Object[] { list1.getName(), list1.getDescription(), list1.getNearCity() });
        }
    } catch (ExecutionException ex) {

    } catch (InterruptedException ex) {
        throw new RuntimeException("Operation interrupted", ex);
    }
}

From source file:Gui.MainGuiBuilder.java

public static void UserTableUpdate() {

    DefaultTableModel userTabelModel = (DefaultTableModel) UserTable.getModel();

    listUser = uService.getUserList();// ww w. j a  v  a  2s.c o m
    //userTableModel.
    userTabelModel.setRowCount(listUser.size());
    for (int i = 0; i < listUser.size(); i++) {

        UserTable.setValueAt(listUser.get(i).getId(), i, 0);
        UserTable.setValueAt(listUser.get(i).getNom(), i, 1);
        UserTable.setValueAt(listUser.get(i).getPrenom(), i, 2);
        UserTable.setValueAt(listUser.get(i).getMail(), i, 3);
        UserTable.setValueAt(listUser.get(i).getPassword(), i, 4);
        UserTable.setValueAt(listUser.get(i).getAdresse(), i, 5);
        UserTable.setValueAt(listUser.get(i).getTelephone(), i, 6);
        UserTable.setValueAt(listUser.get(i).getUserType(), i, 7);
    }
}

From source file:cz.muni.fi.mushroomhunter.restclient.AllMushroomsSwingWorker.java

@Override
protected void done() {
    try {/*from  w  ww  . j a  v  a2  s  . co  m*/
        get();
    } catch (Exception e) {
        restClient.getlMessageMushrooms().setText("ERROR: server is unavailable.");
        return;
    }
    try {
        List<MushroomDto> list = get();
        DefaultTableModel model = (DefaultTableModel) restClient.getTblMushroom().getModel();
        model.setRowCount(0);
        for (int i = 0; i < list.size(); i++) {
            RestClient.getMushroomIDs().add(list.get(i).getId());

            SimpleDateFormat MMMMFormat = new SimpleDateFormat("MMMM", new Locale("en_US"));
            String startOfOccurence = MMMMFormat.format(list.get(i).getStartOfOccurence());
            String endOfOccurence = MMMMFormat.format(list.get(i).getEndOfOccurence());

            model.addRow(new Object[] { list.get(i).getName(), list.get(i).getType().toString(),
                    startOfOccurence, endOfOccurence });
        }
    } catch (ExecutionException ex) {

    } catch (InterruptedException ex) {
        throw new RuntimeException("Operation interrupted", ex);
    }
}

From source file:UserInterface.SearchPatientJPanel.java

public void populateTable() {
    DefaultTableModel dtm = (DefaultTableModel) patientTable.getModel();
    dtm.setRowCount(0);
    for (Person P : personDirectory.getpersonDirectory()) {
        if (P.getPatient().getPatientId() != null) {
            Object row[] = new Object[4];
            row[0] = P.getPatient();/*from  ww  w  .j ava  2  s  .  co m*/
            row[1] = P.getPatient().getPatientId();
            row[2] = P.getPatient().getDoctorName();
            row[3] = P.getPatient().getPharmacy();
            dtm.addRow(row);
        }
    }
}

From source file:userInterface.CustomerWorkArea.ViewSensorHistoryJPanel.java

public void populateTable() {
    DefaultTableModel model = (DefaultTableModel) sensorJTable.getModel();
    model.setRowCount(0);
    for (CarInspection carInspection : userAccount.getPerson().getCarInspectionHistory()
            .getCarInspectionHistory()) {
        Object[] row = new Object[7];
        row[0] = carInspection.getTimestamp();
        row[1] = carInspection.getAlignment();
        row[2] = carInspection.getBattery();
        row[3] = carInspection.getBrakingSys();
        row[4] = carInspection.getOilCheck();
        row[5] = carInspection.getPollutionLevel();
        row[6] = carInspection.getTyrePressure();
        model.addRow(row);/*  ww  w .  j  a  v  a  2 s  .  co  m*/
    }
}

From source file:UserInterface.DoctorRole.ViewDonorReport.java

public void PopulateTable() {
    DefaultTableModel model = (DefaultTableModel) DonorsummaryTable.getModel();

    model.setRowCount(0);
    for (VitalSign vs : vitalSigndir.getVitalSignDir()) {
        Object row[] = new Object[4];
        row[0] = vs;//from  w ww .j  a v a  2 s.c om
        row[1] = vs.getBloodPressure();
        row[2] = vs.getBloodPlatlets();
        row[3] = vs.getHemoglobinLevel();
        model.addRow(row);

    }
}