List of usage examples for javax.swing.table DefaultTableModel addRow
public void addRow(Object[] rowData)
From source file:UserInterface.VaccineManufacturer.TrackVaccineWastage.java
public void populateWastageTable(Vaccine vaccine) { DefaultTableModel model = (DefaultTableModel) wastageJTable.getModel(); model.setRowCount(0);/*from ww w . ja v a2s.c om*/ int totalWastage = 0; for (Vaccine vaccineForSale : enterprise.getVaccineInventory().getVaccineInventoryList()) { if (vaccineForSale.getBatchAvailability() > 0 && vaccineForSale.getExpiryDate().before(new Date()) && vaccineForSale.getName().equals(vaccine.getName())) { Object row[] = new Object[2]; row[0] = vaccineForSale.getManufacturingBatch(); totalWastage = totalWastage + vaccineForSale.getBatchAvailability(); row[1] = vaccineForSale.getBatchAvailability(); model.addRow(row); } } totalWastageJTextField.setText(String.valueOf(totalWastage)); }
From source file:StoreAdmin.ManageStoreJPanel.java
private void btnsearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsearchActionPerformed // Store s= (Store)cmbstorelist.getSelectedItem(); String key = txtsearch.getText(); Product result = s.getInventoryDirectory().searchProduct(key); if (result != null) { DefaultTableModel dtm = (DefaultTableModel) tblsearchedproduct.getModel(); dtm.setRowCount(0);// w ww.j a v a 2 s . c o m for (Product p : s.getInventoryDirectory().getInventoryList()) { Object row[] = new Object[4]; row[0] = p; row[1] = p.getProductName(); row[2] = p.getAvailability(); row[3] = p.getSellingPrice(); dtm.addRow(row); } } else { JOptionPane.showMessageDialog(null, "Product doesnot exist", "Success", JOptionPane.PLAIN_MESSAGE); return; } }
From source file:fitmon.WorkoutLog.java
@Override public void actionPerformed(ActionEvent e) { DefaultTableModel model = (DefaultTableModel) tab.getModel(); DateFormat df = new SimpleDateFormat("dd MMMM yyyy"); String workout = (String) fit.getSelectedItem(); double cal = Double.parseDouble(callo.getText()); String date = (time.getDate().getYear() + 1900 + "-" + String.valueOf(time.getDate().getMonth() + 1) + "-" + time.getDate().getDate()); String intensity = (String) level.getSelectedItem(); int min = minutes.getValue(); wktd = new WorkoutData(workout, intensity, min, cal, date); wkt.add(wktd);/* www . j ava 2 s .c om*/ model.addRow(new Object[] { workout, min, intensity, cal, "Remove" }); // try { // wktd.addData(wkt); // } catch (IOException | NoSuchAlgorithmException | InvalidKeyException | JSONException | SQLException | ClassNotFoundException ex) { // Logger.getLogger(Log.class.getName()).log(Level.SEVERE, null, ex); // } // }
From source file:gdt.jgui.entity.fields.JFieldsEditor.java
private void addRow() { try {//from w ww. jav a2 s . c o m JTable table = (JTable) scrollPane.getViewport().getView(); DefaultTableModel model = (DefaultTableModel) table.getModel(); model.addRow(new String[] { "Name" + String.valueOf(model.getRowCount()), "Value" }); } catch (Exception e) { LOGGER.severe(e.toString()); } }
From source file:Interface.Caruser.Pendingrequest.java
public void populatetable() { DefaultTableModel model = (DefaultTableModel) incomingjTable.getModel(); model.setRowCount(0);/*from www . j a va2 s .c o m*/ for (WorkRequest request : organization.getWorkQueue().getWorkRequestList()) { Object[] row = new Object[7]; row[0] = request; row[1] = request.getSender(); row[2] = request.getReceiver(); row[3] = request.getSource(); row[4] = request.getDestination(); Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); row[5] = formatter.format(request.getRequestDate()); row[6] = request.getStatus(); model.addRow(row); } incomingjTable.setSelectionBackground(Color.getHSBColor(0.2F, 0.1F, 0.2F)); incomingjTable.setSelectionForeground(Color.white); }
From source file:StoreAdmin.ManageStoreJPanel.java
private void populateProductTable() { DefaultTableModel dtm = (DefaultTableModel) tblProductDetails.getModel(); dtm.setRowCount(0);/*from w w w.j av a 2 s.c om*/ for (Product product : pc.getProductList()) { Object row[] = new Object[5]; row[0] = product; row[1] = product.getProductName(); row[2] = product.getManufacturer(); row[3] = product.getAvailability(); row[4] = product.getMarkedPrice(); dtm.addRow(row); } }
From source file:Forms.FrmPrincipal.java
private void mostrarPesos(ArrayList<ArrayList<double[]>> w, int[] capas) { int max = 0;/*from w ww . j a v a2 s .c o m*/ for (int capa = 0; capa < capas.length; capa++) { if (capas[capa] >= max) { max = capas[capa]; } } DefaultTableModel modelo = new DefaultTableModel(); tblPesos.setModel(modelo); for (int capa = 0; capa < w.size(); capa++) { modelo.addColumn("Capa " + (capa + 1)); } Object[] object = new Object[4]; object[0] = "1"; object[1] = "2"; object[2] = "3"; object[3] = "4"; modelo.addRow(object); }
From source file:com.view.PortfolioManagerWindow.java
private void PMAddOrderRowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PMAddOrderRowActionPerformed DefaultTableModel m = (DefaultTableModel) PMSendOrderTable.getModel(); m.addRow(new Object[] { null, null, null, null, null, null, null, null, null }); }
From source file:co.edu.eam.dinesoft.egresados.vista.gui.VentanaReportes.java
private void refrescarTablaOfertas(Programa p) { try {// ww w . j a v a2 s . c o m DefaultTableModel dtm = (DefaultTableModel) tablaOfertas.getModel(); dtm.setRowCount(0); List<OfertaLaboral> lista = controlador.ofertaPorPrograma(p); for (OfertaLaboral oferta : lista) { dtm.addRow(new Object[] { oferta.getEmpresa(), oferta.getFechaApertura(), oferta.getFechaCierre(), oferta.getCargo(), oferta.getSalario(), oferta.getResumen() }); } } catch (Exception exc) { exc.printStackTrace(); } }
From source file:Estadistica.VEstadistica.java
public void graficar(boolean isConcurrente, ArrayList<PaginasWeb> sitiosWeb, ArrayList<EstadisticaPalabra> tiemposPalabras, ArrayList<Resultado> resultados) { DefaultCategoryDataset barChartDatos = new DefaultCategoryDataset();// grafico de secuencial for (PaginasWeb paginas : sitiosWeb) { barChartDatos.setValue(paginas.getIncidencias(), "Sitios", paginas.getListaResultados().get(0).getTitulo()); }// w w w .j av a 2s .com //generar los datos de las tablas DefaultTableModel modeloTablaIncidencias; if (isConcurrente == false) { modeloTablaIncidencias = (DefaultTableModel) tablaIncidenciaSec.getModel(); } else { modeloTablaIncidencias = (DefaultTableModel) tablaIncidenciaSConc.getModel(); } Object[] fila = new Object[modeloTablaIncidencias.getColumnCount()]; int cont = 0; for (EstadisticaPalabra palabra : tiemposPalabras) { fila[0] = palabra.getPalabra(); fila[1] = palabra.getTiempo(); modeloTablaIncidencias.addRow(fila); cont++; System.out.println(palabra.getPalabra()); } System.out.println(cont); // Grafico // titulo-titulo arriba JFreeChart grafico = ChartFactory.createBarChart3D("Incidencias por sitio", "Sitios", "Numero de Incidencias", barChartDatos, PlotOrientation.HORIZONTAL, false, true, false); // CategoryPlot barChartCP = grafico.getCategoryPlot(); barChartCP.setRangeGridlinePaint(Color.cyan); ChartPanel barPanel = new ChartPanel(grafico); if (isConcurrente == true) { lienzoConc.removeAll(); lienzoConc.add(barPanel, BorderLayout.CENTER); lienzoConc.validate(); } if (isConcurrente == false) { lienzoSec.removeAll(); lienzoSec.add(barPanel, BorderLayout.CENTER); lienzoSec.validate(); } }