List of usage examples for javax.swing.table DefaultTableModel addRow
public void addRow(Object[] rowData)
From source file:Vista.VentasCiudad.java
private void jButton_executeGeneralVC1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_executeGeneralVC1ActionPerformed //String[] respuesta = client.consultaGeneralCiudad("0;" + jTextField_Ciudad.getText(), "").split(";"); String[] respuesta = client.consultaGeneralCiudad("0;0", jTextField_Ciudad.getText().trim()).split(";"); String[] nombres = { "Id", "Ciudad", "Total Ventas" }; DefaultTableModel dtm = new DefaultTableModel(nombres, respuesta.length); dtm = (DefaultTableModel) this.jTable_ConsultaEspecifica.getModel(); this.jTable_ConsultaGeneral.removeAll(); for (String s : respuesta) { String[] columnasT = s.split("\\t"); dtm.addRow(new Object[] { columnasT[0], columnasT[1], columnasT[2] }); }/* w w w .j a va2s. c o m*/ }
From source file:com.jtk.pengelolaanujian.controller.panitiaController.PrintSoalController.java
public void viewTableListPrintSoal(JTable tableViewListPrintSoal) { List<Soal> soalList = null; SoalFacade soalFacade = new SoalFacade(); soalList = soalFacade.findAllWhereVNVtrue(); Object[] columnsName = { "Kode Soal", "Kode MatKul", "MatKul", "Dosen Pengampu" }; DefaultTableModel dtm = new DefaultTableModel(null, columnsName) { @Override//w ww . j ava 2 s .c om public boolean isCellEditable(int row, int column) { return false; } }; for (Soal soal : soalList) { Object[] o = new Object[4]; o[0] = soal.getSoalKode(); o[1] = soal.getMataKuliah().getMatkulKode(); o[2] = soal.getMataKuliah().getMatkulNama(); o[3] = soal.getMataKuliah().getDosen().getStafNama(); dtm.addRow(o); } tableViewListPrintSoal.setModel(dtm); }
From source file:com.jtk.pengelolaanujian.controller.panitiaController.PrintSoalController.java
public void viewTableListPrintSoalSeluruh(JTable tableViewListPrintSoal) { List<Soal> soalList = null; SoalFacade soalFacade = new SoalFacade(); soalList = soalFacade.findAllWhereVNVtrue(); Object[] columnsName = { "Kode Soal", "Kode MatKul", "MatKul", "Dosen Pengampu" }; DefaultTableModel dtm = new DefaultTableModel(null, columnsName) { @Override/*from www .j a va 2 s.c om*/ public boolean isCellEditable(int row, int column) { return false; } }; for (Soal soal : soalList) { Object[] o = new Object[4]; o[0] = soal.getSoalKode(); o[1] = soal.getMataKuliah().getMatkulKode(); o[2] = soal.getMataKuliah().getMatkulNama(); o[3] = soal.getMataKuliah().getDosen().getStafNama(); dtm.addRow(o); } tableViewListPrintSoal.setModel(dtm); }
From source file:Vista.CuentasCobrar.java
private void jButton_EjecuteCXCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_EjecuteCXCActionPerformed // TODO add your handling code here: String[] resp = client.consultarCuentas("0;0", Client.getCity()).split("\\n"); String[] nombres = { "Nombre", "Numero de Contacto", "Empresa", "Numero de facturas" }; DefaultTableModel dtm = new DefaultTableModel(nombres, resp.length); dtm = (DefaultTableModel) this.jTable_CuentasPorCobrar.getModel(); this.jTable_CuentasPorCobrar.removeAll(); for (String s : resp) { String[] columnasT = s.split("\\t"); dtm.addRow(new Object[] { columnasT[1], columnasT[2], columnasT[3], columnasT[4] }); }//from w w w. j av a 2 s . c o m }
From source file:Vista.CuentasCobrar.java
private void jButton_EjecuteCXC1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_EjecuteCXC1ActionPerformed // TODO add your handling code here: String[] resp = client.consultarCuentas("0;0", jTextField_Ciudad.getText().trim()).split("\\n"); String[] nombres = { "Nombre", "Numero de Contacto", "Empresa", "Numero de facturas" }; DefaultTableModel dtm = new DefaultTableModel(nombres, resp.length); dtm = (DefaultTableModel) this.jTable_CuentasPorCobrar.getModel(); this.jTable_CuentasPorCobrar.removeAll(); for (String s : resp) { String[] columnasT = s.split("\\t"); dtm.addRow(new Object[] { columnasT[1], columnasT[2], columnasT[3], columnasT[4] }); }// w w w. j ava 2 s .c o m }
From source file:UserInterface.SupplierRole.ProductReportJPanel.java
private void populateProducts() { // Collections.sort(supplier.getProductCatalog().getProductCatalog(), new Comparator<Product>(){ ////from w ww . j a va2 s .c o m // public int compare(Product o1, Product o2) { // if(o1.getSoldQuantity() < o2.getSoldQuantity()) // return 1; // else if(o1.getSoldQuantity() > o2.getSoldQuantity()) // return -1; // return 0; // } // }); DefaultTableModel dtm = (DefaultTableModel) salestbl.getModel(); dtm.setRowCount(0); for (Product p : supplier.getProductCatalog().getProductCatalog()) { Object row[] = new Object[4]; row[0] = p; row[1] = p.getSoldQuantity(); row[2] = p.getPrice(); row[3] = (p.getSoldQuantity() * p.getPrice()); dtm.addRow(row); } }
From source file:TableSorter.java
/** * @param ro/*from ww w . jav a 2 s .c o m*/ */ public void addRow(Object[] ro) { DefaultTableModel tm = (DefaultTableModel) getTableModel(); tm.addRow(ro); fireTableDataChanged(); }
From source file:cz.moz.ctmanager.main.MainAppFrame.java
public void refreshList() { DefaultTableModel newTableModel = (DefaultTableModel) contactTable.getModel(); newTableModel.setRowCount(0);/* w w w .j a va 2 s . c o m*/ 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 }); } contactTable.setModel(newTableModel); }
From source file:com.ftb2om2.view.MultiplePane.java
private void addDifficultyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addDifficultyActionPerformed PathGetter file = new PathGetter(); String name = file.getPath(false, false, false); if (name != null) { File fileName = new File(name); DefaultTableModel model = (DefaultTableModel) difficultyTable.getModel(); model.addRow( new Object[] { fileName.getName(), name, FilenameUtils.removeExtension(fileName.getName()) }); }/*www. j a v a2s . co m*/ }
From source file:dbseer.gui.panel.DBSeerLiveMonitorPanel.java
public synchronized void setCurrentAverageLatency(long time, int index, double latency) { synchronized (LiveMonitorInfo.LOCK) { DefaultTableModel model = (DefaultTableModel) monitorTable.getModel(); if (model.getRowCount() <= 2 + (index * ROW_PER_TX_TYPE + 1)) { model.addRow(new Object[] { "", "" }); }/*from w ww . j a v a 2 s . co m*/ model.setValueAt(String.format("%.1f", latency), 2 + (index * ROW_PER_TX_TYPE) + 1, 1); if (numTransactionType < index + 1) { String newName = "Type " + (index + 1); transactionNames.add(newName); numTransactionType = index + 1; JLabel newLabel = new JLabel(newName); JButton renameButton = new JButton("Rename"); JButton viewSampleButton = new JButton("View Examples"); // JButton enableDisableButton; // if (DBSeerGUI.liveDataset.isTransactionEnabled(index)) // { // enableDisableButton = new JButton("Disable"); // } // else // { // enableDisableButton = new JButton("Enable"); // } renameButton.addActionListener(this); viewSampleButton.addActionListener(this); // enableDisableButton.addActionListener(this); transactionTypesPanel.add(newLabel); transactionTypesPanel.add(renameButton); transactionTypesPanel.add(viewSampleButton); // transactionTypesPanel.add(enableDisableButton); transactionLabels.add(newLabel); transactionRenameButtons.add(renameButton); transactionViewSampleButtons.add(viewSampleButton); // transactionEnableDisableButtons.add(enableDisableButton); throughputCollection.addSeries(new TimeSeries(newName, Millisecond.class)); latencyCollection.addSeries(new TimeSeries(newName, Millisecond.class)); this.revalidate(); this.repaint(); } model.setValueAt( String.format("Current average latency of '%s' transactions", transactionNames.get(index)), 2 + (index * ROW_PER_TX_TYPE) + 1, 0); if (index < latencyCollection.getSeriesCount()) { TimeSeries series = latencyCollection.getSeries(index); // series.add(new Millisecond(), latency); series.addOrUpdate(new Millisecond(new Date(time * 1000)), latency); } } }