List of usage examples for javax.swing.table DefaultTableModel setRowCount
public void setRowCount(int rowCount)
From source file:TableSorter.java
/** * @param i//from ww w .j av a 2s . c om */ public void setRowCount(int i) { DefaultTableModel tm = (DefaultTableModel) getTableModel(); tm.setRowCount(i); fireTableDataChanged(); }
From source file:userinterface.PatientRole.PatientWorkAreaJPanel.java
public void populateVStable() { DefaultTableModel model = (DefaultTableModel) tblVS.getModel(); model.setRowCount(0); for (VitalSign vs : patient.getVitalSignHistory().getVitalSignHistory()) { Object[] row = new Object[5]; row[0] = vs;/*www . ja v a 2 s .com*/ row[1] = vs.getRespiratoryRate(); row[2] = vs.getHeartRate(); row[3] = vs.getWeight(); row[4] = vs.getSystolicBloodPressure(); model.addRow(row); } }
From source file:UserInterface.FinanceRole.DonateToPoorPeopleJPanel.java
private void populateTransactionTable(Person objPerson) { //Chart/*from ww w . ja v a 2s .co m*/ DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); //Table DefaultTableModel dtm = (DefaultTableModel) donationHistoryJTable.getModel(); dtm.setRowCount(0); if (objPerson != null) { for (Transaction objTransaction : objPerson.getObjPoorPeopleTransactionDirectory() .getTransactionList()) { if (objTransaction.getTransactionSource() .equals(Transaction.TransactionSourceType.FromWorldEnterprise.getValue())) { Object row[] = new Object[3]; row[0] = objTransaction; row[1] = "$ " + objTransaction.getTransactionBDAmount(); row[2] = objTransaction.getTransactionDateToDisplay(); dtm.addRow(row); dataSet.setValue(objTransaction.getTransactionBDAmount(), "Amount", objTransaction.getTransactionDateToDisplay()); } } JFreeChart chart = ChartFactory.createBarChart3D("Overview of entire Transaction", "Transaction Date", "Amount in USD $", dataSet, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinePaint(Color.black); ChartPanel myChart = new ChartPanel(chart); transferDetailsJPanel.setLayout(new java.awt.BorderLayout()); transferDetailsJPanel.add(myChart, BorderLayout.CENTER); transferDetailsJPanel.validate(); transferDetailsJPanel.setVisible(true); } else { transferDetailsJPanel.setVisible(false); } }
From source file:com.firmansyah.imam.sewa.kendaraan.FormUser.java
public void showDataUser() { try {/*from w w w . j a v a 2 s . com*/ getDataURL dataurl = new getDataURL(); DefaultTableModel model = (DefaultTableModel) tblPelanggan.getModel(); model.setRowCount(0); String url = Path.serverURL + "/user/show/"; String data = dataurl.getData(url); Object obj = JSONValue.parse(data); JSONArray dataArray = (JSONArray) obj; System.out.println("Banyak datanya : " + dataArray.size()); for (int i = 0; i < dataArray.size(); i++) { JSONObject getData = (JSONObject) dataArray.get(i); String cek_status = getData.get("status").toString(); if (cek_status.equals("0")) { cek_status = "Non Aktif"; } else { cek_status = "Aktif"; } Object[] row = { i + 1, getData.get("nama"), getData.get("username"), cek_status, getData.get("id"), }; model.addRow(row); } } catch (IOException ex) { Logger.getLogger(FormUser.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:dylemator.UserResultList.java
private void codeTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_codeTableMouseClicked int row = this.codeTable.getSelectedRow(); DefaultTableModel infoModel = (DefaultTableModel) this.infoTable.getModel(); DefaultTableModel resultsModel = (DefaultTableModel) this.resultsTable.getModel(); String[] headers = exportData.get(0); String[] values = exportData.get(row + 1); infoModel.setRowCount(0); resultsModel.setRowCount(0);//from w ww .j a va 2s. c o m for (int i = 0; i < 15; i++) { infoModel.addRow(new String[] { headers[i], values[i] }); } for (int i = 15; i < headers.length; i++) { resultsModel.addRow(new String[] { headers[i], values[i] }); } }
From source file:userinterface.PatientRole.PatientWorkAreaJPanel.java
public void populateWorkReqTable() { DefaultTableModel model = (DefaultTableModel) workRequestJTable.getModel(); model.setRowCount(0); 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);//from w ww . jav a 2 s. c om } } }
From source file:ca.uviccscu.lp.server.main.MainFrame.java
public static int getNextFreeRowNumber() { DefaultTableModel md = (DefaultTableModel) jTable1.getModel(); if (jTable1.getRowCount() == 0) { md.setRowCount(1); return 0; }/*w w w.j a va2s . c o m*/ int i = 0; for (; i < jTable1.getRowCount(); i++) { if (jTable1.getValueAt(i, 0) == null) { return i; } } return i; }
From source file:dylemator.UserResultList.java
private void filenameComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filenameComboActionPerformed Object item = this.filenameCombo.getSelectedItem(); exportData = new ArrayList<String[]>(); File file = new File(item.toString()); if (file.exists()) { this.selectedFilename = item.toString(); String datePattern = "(\\d+-\\d+-\\d+)"; Pattern r = Pattern.compile(datePattern); Matcher m = r.matcher(file.getName()); String fileDate;//from w ww .j a v a 2 s . c o m if (m.find()) { fileDate = m.group(0); } else fileDate = new Date(file.lastModified()).toString(); DefaultTableModel codeModel = (DefaultTableModel) this.codeTable.getModel(); DefaultTableModel infoModel = (DefaultTableModel) this.infoTable.getModel(); DefaultTableModel resultsModel = (DefaultTableModel) this.resultsTable.getModel(); codeModel.setRowCount(0); codeModel.setColumnCount(0); infoModel.setRowCount(0); infoModel.setColumnCount(2); resultsModel.setRowCount(0); resultsModel.setColumnCount(2); try { InputStreamReader input = new FileReader(file); BufferedReader bufferReader; bufferReader = new BufferedReader(input); // headers String headerLine = bufferReader.readLine(); String[] headers = headerLine.split(";", -1); codeModel.addColumn(headers[0]); exportData.add((String[]) headers); String line; while ((line = bufferReader.readLine()) != null) { String[] fields = line.split(";", -1); exportData.add((String[]) fields); codeModel.addRow(new String[] { fields[0] }); } bufferReader.close(); } catch (FileNotFoundException ex) { Logger.getLogger(FindDialog.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(FindDialog.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:userinterface.PatientRole.PatientWorkAreaJPanel.java
public void populateAppointments() { DefaultTableModel model = (DefaultTableModel) appointMentRequestJTable1.getModel(); int index = 1; model.setRowCount(0); for (WorkRequest request : userAccount.getWorkQueue().getWorkRequestList()) { if (request instanceof AppointmentWorkRequest) { Object[] row = new Object[4]; //row[0] = request.getMessage(); row[0] = index++;/*from ww w . j ava 2 s . c o m*/ row[1] = request.getReceiver() == null ? null : request.getReceiver().getEmployee().getName(); row[2] = ((AppointmentWorkRequest) request).getAppointmentDateTime() == null ? null : ((AppointmentWorkRequest) request).getAppointmentDateTime(); row[3] = request.getStatus(); String result = ((AppointmentWorkRequest) request).getTestResult(); //row[4] = result == null ? "Waiting" : result; model.addRow(row); } } }
From source file:Interface.FoodDistributionWorkArea.FoodDistributionWorkArea.java
public void populateTable() { DefaultTableModel model = (DefaultTableModel) tblFoodDistribution.getModel(); model.setRowCount(0); for (WorkRequest request : organization.getWorkQueue().getWorkRequestList()) { if (!request.getStatus().equalsIgnoreCase("Distributed")) { Object[] row = new Object[7]; row[0] = ((FoodDistributionWorkRequest) request); row[1] = ((FoodDistributionWorkRequest) request).getFood().getFoodBarCode(); row[2] = ((FoodDistributionWorkRequest) request).getFood().getQuantity(); row[3] = ((FoodDistributionWorkRequest) request).getFood().getFoodExpiryDate(); row[4] = ((FoodDistributionWorkRequest) request).getStatus(); row[5] = ((FoodDistributionWorkRequest) request).getMessage(); row[6] = ((FoodDistributionWorkRequest) request).getStandardSupervisor(); model.addRow(row);//from www.j ava 2s .co m } } }