List of usage examples for javax.swing.table DefaultTableModel removeRow
public void removeRow(int row)
row
from the model. From source file:controldeadministradores.Admin.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: DefaultTableModel model = (DefaultTableModel) jtbl_RepoteVuelosAeropuerto.getModel(); int rowCount = model.getRowCount(); //Remove rows one by one from the end of the table for (int i = rowCount - 1; i >= 0; i--) { model.removeRow(i); }//ww w .j a va2 s . c o m String res = ""; try { res = get(servidorDir + "/vuelos"); JSONArray obj = new JSONArray(res); for (int i = 0; i < obj.length(); i++) { JSONObject a = obj.getJSONObject(i); String aero = jtxt_aeropuerto.getText(); String estado = a.get("state").toString(); String origen = a.get("origin").toString(); String destino = a.get("destiny").toString(); if ((estado.equals("En Aeropuerto") && origen.equals(aero)) || (estado.equals("En Arribo") && destino.equals(aero))) { model.addRow( new Object[] { a.get("id_fly"), a.get("origin"), a.get("destiny"), a.get("date_out"), a.get("date_in"), a.get("price_fc"), a.get("price_tc"), a.get("price_ec"), a.get("amount_fc"), a.get("amount_tc"), a.get("amount_ec"), a.get("state") }); } } } catch (IOException ex) { Logger.getLogger(Admin.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java
private void populateTab3Table() { int rowCount = tab3jTable.getRowCount(); DefaultTableModel dtm = (DefaultTableModel) tab3jTable.getModel(); //delete all the previous rows for (int i = rowCount - 1; i >= 0; i--) { dtm.removeRow(i); }//from w w w . j ava 2 s. com for (MedicalDevice md : inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList()) { Object[] row = new Object[4]; row[0] = md; row[1] = md.getDeviceCatagory(); row[2] = md.getAvailableQuantity(); row[3] = md.getServiceInterval(); dtm.addRow(row); } }
From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java
private void populateTab4Table() { int rowCount = tab4jTable.getRowCount(); DefaultTableModel dtm = (DefaultTableModel) tab4jTable.getModel(); //delete all the previous rows for (int i = rowCount - 1; i >= 0; i--) { dtm.removeRow(i); }// ww w.j a v a2s. c o m for (MedicalDevice md : inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList()) { Object[] row = new Object[4]; row[0] = md; row[1] = md.getDeviceCatagory(); row[2] = md.getAvailableQuantity(); row[3] = md.getServiceInterval(); dtm.addRow(row); } }
From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java
private void populateDeliveryTable() { int rowCount = deliveryJTable.getRowCount(); DefaultTableModel dtm = (DefaultTableModel) deliveryJTable.getModel(); //delete all the previous rows for (int i = rowCount - 1; i >= 0; i--) { dtm.removeRow(i); }// w w w .j a v a2s . c om for (Order o : inventoryEnterprise.getOrderDelivery().getOrderList()) { Object[] row = new Object[1]; row[0] = o; dtm.addRow(row); } }
From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java
private void populateWarehouseDevicesTable() { int rowCount = warehouseDevicesjTable.getRowCount(); DefaultTableModel dtm = (DefaultTableModel) warehouseDevicesjTable.getModel(); //delete all the previous rows for (int i = rowCount - 1; i >= 0; i--) { dtm.removeRow(i); }//from w w w .j a va 2s.c o m for (MedicalDevice md : inventoryEnterprise.getWarehouse().getMdeciDeviceCatalog().getMedicalDeviceList()) { Object[] row = new Object[4]; row[0] = md; row[1] = md.getDeviceCatagory(); row[2] = md.getAvailableQuantity(); row[3] = md.getServiceInterval(); dtm.addRow(row); } }
From source file:User.Interface.InventoryAdminRole.InventoryAdminWorkAreaJPanel.java
private void populateDetailsOrderTable() { //get the selected order int selectedRow = deliveryJTable.getSelectedRow(); if (selectedRow < 0) { JOptionPane.showMessageDialog(this, "Please select an order from the list"); return;/*from w w w . j av a 2 s . c o m*/ } Order o = (Order) deliveryJTable.getValueAt(selectedRow, 0); if (null == o) { JOptionPane.showMessageDialog(this, "Failed to retrieve selected order's information"); return; } int rowCount = detailsorderJTable.getRowCount(); DefaultTableModel dtm = (DefaultTableModel) detailsorderJTable.getModel(); //delete all the previous rows for (int i = rowCount - 1; i >= 0; i--) { dtm.removeRow(i); } for (OrderItem oi : o.getOrderItemList()) { Object[] row = new Object[4]; row[0] = oi; row[1] = oi.getMedicalDevice().getPrice(); row[2] = oi.getQuantity(); row[3] = (oi.getMedicalDevice().getPrice() * oi.getQuantity()); dtm.addRow(row); } }
From source file:it.unifi.rcl.chess.traceanalysis.gui.TracePanel.java
private void phaseDetection() { final class Phase { int start; int end;//from www. j a va2 s. co m CHDistribution dist; double bound; public Phase(int start, int end) { this.start = start; this.end = end; } } double coverage = Double.parseDouble(txtPhasesCoverage.getText()); int wsize = Integer.parseInt(txtPhasesWSize.getText()); CHDistribution[] dists = trace.getPhases(coverage, wsize); CHDistribution curDist = null; CHDistribution lastDist = null; int iPhaseBegin, iPhaseEnd; Phase p = null; DefaultTableModel model = (DefaultTableModel) tablePhases.getModel(); while (model.getRowCount() > 0) { model.removeRow(0); } if (wsize > 1) { // ignore initial window model.addRow(new Object[] { 1, (wsize - 1), "{undefined}", "" }); } iPhaseBegin = 0; iPhaseEnd = 0; curDist = dists[0]; for (int i = 1; i < dists.length; i++) { lastDist = curDist; curDist = dists[i]; if (!curDist.equals(lastDist)) { // distribution is different from the previous: phase change p = new Phase(iPhaseBegin, iPhaseEnd + (wsize - 1)); p.dist = lastDist; p.bound = trace.getSubTrace(p.start, p.end).getBound(coverage); iPhaseBegin = i; iPhaseEnd = i; model.addRow(new Object[] { p.start + 1 + (wsize - 1), p.end + 1, p.dist.toString(), p.bound }); } else { // distribution is the same (also parameters), phase is extended iPhaseEnd++; } } p = new Phase(iPhaseBegin, iPhaseEnd + (wsize - 1)); p.dist = lastDist; p.bound = trace.getSubTrace(p.start, p.end).getBound(coverage); model.addRow(new Object[] { p.start + 1 + (wsize - 1), p.end + 1, p.dist.toString(), p.bound }); tablePhases.setModel(model); }
From source file:UserInterface.ViewPatientJPanel.java
private void populateTable() { DefaultTableModel dtm = (DefaultTableModel) tblVitalSigns.getModel(); int rowCount = dtm.getRowCount(); for (int x = rowCount - 1; x >= 0; x--) { dtm.removeRow(x); }//from w w w . j a va2 s . co m for (VitalSign vs : patient.vitalSignHistory.getVitalSignHistory()) { Object row[] = new Object[2]; row[0] = vs; row[1] = vs.getState(); dtm.addRow(row); } }
From source file:graph.plotter.LineGraph.java
/** * This method works for deleting a data entry * @param evt //from w ww . j a v a 2s. com */ private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: DefaultTableModel model = (DefaultTableModel) Table.getModel(); model.removeRow(Table.getSelectedRow()); cnt--; }
From source file:ExtendedDnDDemo.java
protected void cleanup(JComponent c, boolean remove) { JTable source = (JTable) c; if (remove && rows != null) { DefaultTableModel model = (DefaultTableModel) source.getModel(); //If we are moving items around in the same table, we //need to adjust the rows accordingly, since those //after the insertion point have moved. if (addCount > 0) { for (int i = 0; i < rows.length; i++) { if (rows[i] > addIndex) { rows[i] += addCount; }/*from w ww . j ava 2s .c o m*/ } } for (int i = rows.length - 1; i >= 0; i--) { model.removeRow(rows[i]); } } rows = null; addCount = 0; addIndex = -1; }