List of usage examples for javax.swing.table DefaultTableModel setRowCount
public void setRowCount(int rowCount)
From source file:functions.LoadCSVdata.java
public void LoadFeeDataToJTable(JTable t, String path) { try {// w ww .j av a 2s.c om file = new File(path); parser = CSVParser.parse(file, Charset.forName("UTF-8"), CSVFormat.DEFAULT); DefaultTableModel model = (DefaultTableModel) t.getModel(); model.setRowCount(0); for (CSVRecord c : parser) { if (c.getRecordNumber() == 1) continue; model.addRow( new Object[] { c.get(datatype.GlobalVariable.TYPE), c.get(datatype.GlobalVariable.AMOUNT), c.get(datatype.GlobalVariable.PAID_BY), c.get(datatype.GlobalVariable.PAYER) }); } } catch (Exception e) { System.out.println(e); } }
From source file:tp1.G_AdminStats.java
private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowGainedFocus // TODO add your handling code here: Map<String, Integer> att = new HashMap<String, Integer>(); DefaultTableModel model = (DefaultTableModel) tab3.getModel(); model.setRowCount(0); try {// w w w . ja va2 s .c o m Class.forName("java.sql.DriverManager"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/projectbuy", "root", "null"); Statement stmt = (Statement) con.createStatement(); String query = "SELECT usr, count(DISTINCT Datee) FROM attendence GROUP BY usr;"; ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String a = rs.getString(1); String b = rs.getString(2); model.addRow(new Object[] { a, b }); att.put(a, Integer.parseInt(b)); } } catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Map.Entry<String, Integer> entry : att.entrySet()) { dataset.addValue(entry.getValue(), "series1", entry.getKey()); } JFreeChart chart = ChartFactory.createBarChart("Attendence", "Admin Name", "Days Present", dataset, PlotOrientation.VERTICAL, false, true, false); try { BufferedImage chartImage = chart.createBufferedImage(800, 300, null); labelGraph.setIcon(new javax.swing.ImageIcon(chartImage)); } catch (Exception e) { System.out.println(e.getMessage()); } }
From source file:UserInterface.CDC.VaccineStateDistributionJPanel.java
private void populateTable() { DefaultTableModel model = (DefaultTableModel) summaryjTable.getModel(); model.setRowCount(0); if (business.getStateList() != null) { for (StateNetwork state : business.getStateList()) { Object[] row = new Object[2]; row[0] = state;/*from w w w . ja va 2 s.co m*/ row[1] = state.getTotalVaccinesDistributedInState(); model.addRow(row); } } }
From source file:UserInterface.CDC.VARESReportingJPanel.java
private void populateTable() { DefaultTableModel model = (DefaultTableModel) summaryjTable.getModel(); model.setRowCount(0); if (business.getStateList() != null) { for (StateNetwork state : business.getStateList()) { Object[] row = new Object[3]; row[0] = state;//from w w w.j ava2s .co m row[1] = state.getTotalVaccinesAdministeredInState(); row[2] = state.getTotalFailedVaccinesInState(); model.addRow(row); } } }
From source file:UserInterface.DonorRole.DonorRecordsJPanel.java
public void populateTable() { DefaultTableModel dtm = (DefaultTableModel) donorHormoneLevelsJTbl.getModel(); dtm.setRowCount(0); for (Employee donor : organization.getEmployeeDirectory().getEmployeeList()) { if (donor.getName().equalsIgnoreCase(userAccount.getEmployee().getName())) { for (HormonalRecords hr : donor.getHormonalRecordsHistory().getHormonalRecordsList()) { Object row[] = new Object[5]; row[0] = hr;//from w w w.ja va 2s . c o m row[1] = hr.getLeutinizingHormoneLevels(); row[2] = hr.getFollicleStimulatingHormoneLevels(); row[3] = hr.gethCGLevels(); row[4] = hr.getTempDropIOT(); dtm.addRow(row); } } } }
From source file:userinterface.SystemAdminWorkArea.DisplayOperationJPanel.java
public void populateTable() { DefaultTableModel model = (DefaultTableModel) treatmentTable.getModel(); model.setRowCount(0); Network network = (Network) stateCombo.getSelectedItem(); for (Enterprise enterprise : network.getEnterpriseDirectory().getEnterpriseList()) { TreatedFor t = enterprise.findMaxVal(); Object row[] = new Object[3]; row[0] = enterprise;//from w w w .j a va2s . c om row[1] = t == null ? "No patient Diagnosed Yet!" : t.getTreatment(); row[2] = t == null ? "No patient Diagnosed Yet!" : t.getCount(); model.addRow(row); } }
From source file:userinterface.SystemAdminWorkArea.DisplayAllergyJPanel.java
public void populateTable() { DefaultTableModel model = (DefaultTableModel) allergyTable.getModel(); model.setRowCount(0); Network network = (Network) stateCombo.getSelectedItem(); for (Enterprise enterprise : network.getEnterpriseDirectory().getEnterpriseList()) { Allergy a = enterprise.findMaxValue(); Object row[] = new Object[3]; row[0] = enterprise;//from ww w.j a v a 2 s . c o m row[1] = a == null ? "No patient Diagnosed Yet!" : a.getAllergyName(); row[2] = a == null ? "No patient Diagnosed Yet!" : a.getCount(); model.addRow(row); } }
From source file:userInterface.ManufacturerRole.ViewInventoryJPanel.java
private void populateTable() { DefaultTableModel dtm = (DefaultTableModel) VaacineJTable.getModel(); dtm.setRowCount(0); for (Batch b : enterprise.getInventory().getBatchList()) { Object[] row = new Object[7]; row[0] = b.getBatchNumber();/* w w w .jav a 2s .c o m*/ row[1] = b.getVaccine().getCode(); row[2] = b.getVaccine().getName(); row[3] = b.getVaccine().getQuantity(); row[4] = b.getVaccine().getStock(); row[5] = b.getVaccine().getPrice() * b.getVaccine().getQuantity(); row[6] = b.getVaccine().getFixedQty(); dtm.addRow(row); totalInventory = b.getVaccine().getQuantity() + totalInventory; enterprise.getInventory().setTotalQuantity(totalInventory); } }
From source file:cz.moz.ctmanager.main.MainAppFrame.java
public void refreshList() { DefaultTableModel newTableModel = (DefaultTableModel) contactTable.getModel(); newTableModel.setRowCount(0); List<Contact> contactList = contactsDao.getAllContacts(); for (Contact iteratorContact : contactList) { int id = iteratorContact.getID(); String firstName = iteratorContact.getFirstName(); String lastName = iteratorContact.getLastName(); String address = iteratorContact.getAddress(); newTableModel.addRow(new Object[] { id, firstName, lastName, address }); }/*w w w . j a v a 2s.c o m*/ contactTable.setModel(newTableModel); }
From source file:UserInterface.ReciepientRole.RecepientRecordJPanel.java
public void populateTable() { DefaultTableModel dtm = (DefaultTableModel) recHormonalRecordsJTbl.getModel(); dtm.setRowCount(0); //System.err.println("the user is "+userAccount); //System.err.println("the request list is "+userAccount.getWorkQueue().getWorkRequestList()); for (Employee recepient : organization.getEmployeeDirectory().getEmployeeList()) { if (recepient.getName().equalsIgnoreCase(userAccount.getEmployee().getName())) { for (HormonalRecords hr : recepient.getHormonalRecordsHistory().getHormonalRecordsList()) { Object row[] = new Object[5]; row[0] = hr;/*from w w w.java 2 s. c o m*/ row[1] = hr.getLeutinizingHormoneLevels(); row[2] = hr.getFollicleStimulatingHormoneLevels(); row[3] = hr.gethCGLevels(); row[4] = hr.getTempDropIOT(); dtm.addRow(row); } } } }