List of usage examples for javax.swing.table DefaultTableModel setRowCount
public void setRowCount(int rowCount)
From source file:userInterface.HospitalAdminRole.ManagePatientsJPanel.java
public void populateAlertFamilyTable() { DefaultTableModel model = (DefaultTableModel) vitalSignAlertsTable.getModel(); model.setRowCount(0); for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) { if (request instanceof HosptoHouseWorkRequest) { Object[] row = new Object[5]; row[0] = request;//from w ww . java2 s .co m String alert = ((HosptoHouseWorkRequest) request).getAdminMessage(); row[1] = alert == null ? "No Alert" : alert; row[2] = request.getRequestDate(); row[3] = ((HosptoHouseWorkRequest) request).getAppointmentDate(); //row[6] = ((HospitalWorkRequest)request).getAppointmentTime(); row[4] = request.getStatus(); model.addRow(row); } } }
From source file:Gui.MainGuiBuilder.java
public void recherchePost() { String titre = searchPost.getText(); String gouvernorat = (String) FilterGouvernorat.getSelectedItem(); String rubrique = (String) FiltreRubrique.getSelectedItem(); String nature = (String) FilterNature.getSelectedItem(); String type = (String) FilterType.getSelectedItem(); int prix = filterPrix.getValue() * 10000; System.out.println(prix);// w ww . j a v a 2s . com ArrayList<Post> pList = pService.searchPost(titre, gouvernorat, rubrique, nature, type, prix); DefaultTableModel postTabelModel = (DefaultTableModel) PostTable.getModel(); //userTableModel. postTabelModel.setRowCount(pList.size()); for (int i = 0; i < pList.size(); i++) { PostTable.setValueAt(pList.get(i).getId(), i, 0); PostTable.setValueAt(pList.get(i).getTitre(), i, 1); PostTable.setValueAt(pList.get(i).getText(), i, 2); PostTable.setValueAt(pList.get(i).getDateCreation(), i, 3); PostTable.setValueAt(pList.get(i).getGouvernorat(), i, 4); PostTable.setValueAt(pList.get(i).getRubrique(), i, 5); PostTable.setValueAt(pList.get(i).getNature(), i, 6); PostTable.setValueAt(pList.get(i).getType(), i, 7); PostTable.setValueAt(pList.get(i).getPrix(), i, 8); PostTable.setValueAt(pList.get(i).getUserMail(), i, 9); } }
From source file:userInterface.HospitalAdminRole.ManagePatientsJPanel.java
public void populateDoctorAlertTable() { DefaultTableModel dtm = (DefaultTableModel) alertRequestDetailsTable.getModel(); dtm.setRowCount(0); for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) { if (request instanceof HospitalWorkRequest) { if (userAccount.getWorkQueue().getWorkRequestList() != null) { Object[] row = new Object[6]; row[0] = request;// www . ja v a2s . c o m UserAccount receiver = ((HospitalWorkRequest) request).getReceiver(); row[1] = receiver == null ? "Doctor not assigned" : receiver; row[2] = request.getRequestDate(); row[3] = request.getSeverity(); row[4] = ((HospitalWorkRequest) request).getAlert(); row[5] = request.getStatus(); dtm.addRow(row); } } } }
From source file:com.smanempat.controller.ControllerEvaluation.java
private double[][] evaluationModel(JTable tableResult, JTable tableConfMatrix, JLabel totalAccuracy, JTable tableTahunTesting, JTable tableDataSetTesting, String[] knnValue, int nilaiK, JPanel panelChart) throws SQLException { int actIPA = 0; int actIPS = 0; int trueIPA = 0; int falseIPA = 0; int trueIPS = 0; int falseIPS = 0; int classIPA = 0; int classIPS = 0; double recIPA; double recIPS; double preIPA; double preIPS; double accuracy; DefaultTableModel tableModelConf = (DefaultTableModel) tableConfMatrix.getModel(); DefaultTableModel tableModelRes = (DefaultTableModel) tableResult.getModel(); String[] tempJurusan = getJurusanTest(tableTahunTesting, tableDataSetTesting); if (tableModelRes.getRowCount() != 0) { tableModelRes.setRowCount(0); }/*from ww w. ja va 2s .c om*/ for (int j = 0; j < tableDataSetTesting.getRowCount(); j++) { String nis = tableDataSetTesting.getValueAt(j, 0).toString(); String jurusan = tempJurusan[j]; String classified = knnValue[j]; Object[] tableContent = { nis, jurusan, classified }; tableModelRes.addRow(tableContent); tableResult.setModel(tableModelRes); } /*Hitung Jumlah Data Actual IPA dan IPS*/ for (int j = 0; j < tempJurusan.length; j++) { if (tempJurusan[j].equals("IPA")) { actIPA = actIPA + 1; } else if (tempJurusan[j].equals("IPS")) { actIPS = actIPS + 1; } } /*Hitung Jumlah Data Classified IPA dan IPS*/ for (int j = 0; j < knnValue.length; j++) { if (tableResult.getValueAt(j, 1).equals("IPA")) { if (tableResult.getValueAt(j, 1).equals(tableResult.getValueAt(j, 2))) { trueIPA = trueIPA + 1; } else { falseIPS = falseIPS + 1; } } else if (tableResult.getValueAt(j, 1).equals("IPS")) { if (tableResult.getValueAt(j, 1).equals(tableResult.getValueAt(j, 2))) { trueIPS = trueIPS + 1; } else { falseIPA = falseIPA + 1; } } } // System.out.println("trueIPA =" + trueIPA); // System.out.println("falseIPA =" + falseIPA); // System.out.println("falseIPS =" + falseIPS); // System.out.println("trueIPS =" + trueIPS); /*Hitung Nilai Recall, Precision, dan Accuracy*/ preIPA = (double) trueIPA / (trueIPA + falseIPA); preIPS = (double) trueIPS / (trueIPS + falseIPS); recIPA = (double) trueIPA / (trueIPA + falseIPS); recIPS = (double) trueIPS / (trueIPS + falseIPA); accuracy = (double) (trueIPA + trueIPS) / (trueIPA + trueIPS + falseIPA + falseIPS); /*Tampung Nilai Recall, Precision, dan Accuracy*/ double[][] tempEval = new double[3][1]; tempEval[0][0] = accuracy; tempEval[1][0] = recIPA; tempEval[2][0] = preIPA; /*Set Nilai TF, TN, FP, FN ke Tabel Confusion Matrix*/ tableModelConf.setValueAt("Actual IPA", 0, 0); tableModelConf.setValueAt("Actual IPS", 1, 0); tableModelConf.setValueAt("Class Precision", 2, 0); tableModelConf.setValueAt(trueIPA, 0, 1); tableModelConf.setValueAt(falseIPS, 0, 2); tableModelConf.setValueAt(falseIPA, 1, 1); tableModelConf.setValueAt(trueIPS, 1, 2); /*Set Nilai Recall, Precision, dan Accuracy ke Tabel Confusion Matrix*/ if (Double.isNaN(preIPA)) { tableModelConf.setValueAt("NaN" + " %", 2, 1); } else { tableModelConf.setValueAt(df.format(preIPA * 100) + " %", 2, 1); } if (Double.isNaN(preIPS)) { tableModelConf.setValueAt("NaN" + " %", 2, 2); } else { tableModelConf.setValueAt(df.format(preIPS * 100) + " %", 2, 2); } if (Double.isNaN(recIPA)) { tableModelConf.setValueAt("NaN" + " %", 0, 3); } else { tableModelConf.setValueAt(df.format(recIPA * 100) + " %", 0, 3); } if (Double.isNaN(recIPS)) { tableModelConf.setValueAt("NaN" + " %", 1, 3); } else { tableModelConf.setValueAt(df.format(recIPS * 100) + " %", 1, 3); } if (Double.isNaN(accuracy)) { totalAccuracy.setText("Overall Accuracy is " + "NaN" + " %"); } else { totalAccuracy.setText("Overall Accuracy is " + df.format(accuracy * 100) + " %"); } // System.out.println("Recall IPA = " + recIPA); // System.out.println("Recall IPA =" + recIPS); // System.out.println("Precision IPA = " + preIPA); // System.out.println("Precision IPS = " + preIPS); // System.out.println("Overall Accuracy = " + accuracy); return tempEval; }
From source file:UserInterface.SystemAdmin.ReportsJPanel.java
private void populateCustomers(ArrayList<Customer> c) { DefaultTableModel model = (DefaultTableModel) customerTable.getModel(); model.setRowCount(0); if (c.size() != 0) { for (Customer cust : c) { Object[] row = new Object[5]; row[0] = cust;//from ww w. j av a 2s.c om row[1] = cust.getId(); row[2] = cust.getContactNo(); row[3] = cust.getEmailId(); row[4] = Math.ceil(cust.getTotalUsageVolume()) + " Gallons"; model.addRow(row); } noteCust.setText(""); } else { model.setRowCount(0); noteCust.setText("*Note : No customers"); } }
From source file:Gui.MainGuiBuilder.java
private void searchUserKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchUserKeyReleased // TODO add your handling code here: // getting filter selection first ! String filter = (String) filterUser.getSelectedItem(); String text = searchUser.getText(); DefaultTableModel userTabelModel = (DefaultTableModel) UserTable.getModel(); listUser = uService.searchUser(filter, text); //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 ww w . j a v a2 s . c o m*/ }
From source file:stockit.Manager.java
private void searchClientBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchClientBtnActionPerformed // TODO add your handling code here: if (listOfClients.isSelectionEmpty()) { JOptionPane.showMessageDialog(getContentPane(), "Please Select a Client", "Error", JOptionPane.ERROR_MESSAGE); } else {/*from w w w . j a v a 2 s .co m*/ String selectedClient = listOfClients.getSelectedValue(); System.out.println(selectedClient); try { 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, client, company\n" + "WHERE client.Name = '" + selectedClient + "'" + "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) table.getModel(); model.setRowCount(0); while (rs.next()) { System.out.println( rs.getString("stockID") + "\t" + rs.getString("Name") + "\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) { Logger.getLogger(clientLogin.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:userInterface.HospitalAdminRole.ManagePatientsJPanel.java
public void populateTable(Person person) { DefaultTableModel model = (DefaultTableModel) vitalSignjTable.getModel(); TableColumnModel tcm = vitalSignjTable.getColumnModel(); CustomTableCellRenderer customCellRenderer = new CustomTableCellRenderer(); model.setRowCount(0); //if(houseOrg.getPersonDir().getPersonDir()!=null){ //for(Person person:houseOrg.getPersonDir().getPersonDir()){ if (person.getMemberDir().getMemberDirectory() != null) { for (Member member : person.getMemberDir().getMemberDirectory()) { int patientAge = member.getAge(); if (member.getVitalSignList().getVitalSignList() != null) { for (VitalSign vs : member.getVitalSignList().getVitalSignList()) { Object[] row = new Object[8]; // vitalSignjTable.getColumnModel().getColumn(7).setMinWidth(0); // vitalSignjTable.getColumnModel().getColumn(7).setMaxWidth(0); // vitalSignjTable.getColumnModel().getColumn(7).setWidth(0); row[0] = member;/* w ww .j av a 2s . c o m*/ row[1] = vs; row[2] = vs.getRespiratoryRate(); row[3] = vs.getHeartRate(); row[4] = vs.getBloodPressure(); row[5] = vs.getTemperature(); row[6] = member.getVitalSignList().VitalSignStatus(patientAge, vs); row[7] = vs.getAlertStatus(); model.addRow(row); tcm.getColumn(6).setCellRenderer(customCellRenderer); } } } } }
From source file:userinterface.DoctorWorkArea.DiagnosePatientJPanel.java
public void populateTable() { DefaultTableModel model = (DefaultTableModel) productTable.getModel(); model.setRowCount(0); for (Product product : enterprise.getProductCatalog().getProductcatalog()) { Object[] row = new Object[4]; row[0] = product;//w ww. j av a 2s .c o m row[1] = product.getModelNumber(); row[2] = product.getPrice(); row[3] = product.getAvailableAmount(); model.addRow(row); } }
From source file:userinterface.DoctorWorkArea.DiagnosePatientJPanel.java
public void populateDietRequestTable() { DefaultTableModel model = (DefaultTableModel) dietRequestJTable.getModel(); model.setRowCount(0); DietitianWorkRequest req = null;//w ww . j ava 2s .c om for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) { if (request instanceof DietitianWorkRequest) { Object[] row = new Object[5]; row[0] = request; row[1] = request.getMessage(); row[2] = request.getReceiver(); row[3] = request.getStatus(); String result = ((DietitianWorkRequest) request).getResult(); row[4] = result == null ? "Waiting" : result; model.addRow(row); } } }