List of usage examples for javax.swing.table DefaultTableModel addRow
public void addRow(Object[] rowData)
From source file:UserInterfaces.HAdministration.FallReportJPanel.java
private void populateTable() { DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.setRowCount(0);/* ww w . j a v a 2 s.com*/ for (WorkRequest w : enterprise.getWorkQueue().getWorkRequestList()) { if (w.getLevel2().equals(ErrorUtil.FALL)) { Object[] row = new Object[3]; row[0] = w.getDateoferror(); row[1] = w.getCauseoffall(); row[2] = w.getSource(); model.addRow(row); } } }
From source file:controldeadministradores.Admin.java
private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed // TODO add your handling code here: DefaultTableModel model = (DefaultTableModel) jtbl_RepoteVuelos.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);//from w w w .j a v a 2 s .c om } 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 c = jcb_estado.getSelectedItem().toString(); String estado = a.get("state").toString(); if (estado.equals(c) || c.equals("Todos")) { 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:main.java.edu.isistan.genCom.gui.Principal.java
/** * Carga la seccin con el resumen de la generacin * /* w w w . ja v a2 s. c o m*/ * @param generacion */ private void cargarGeneracion() { ConfiguracionAG conf = generacionCargada.getConfiguracion(); // Carga la tabla resumen DefaultTableModel dtm = (DefaultTableModel) tbResumen.getModel(); limpiarModelo(dtm); dtm.addRow(new String[] { String.valueOf(generacionCargada.getEjecuciones().size()), conf.getCruce().toString(), conf.getMutacion().toString(), conf.getSeleccion().toString(), conf.getModelo().toString(), String.valueOf(conf.getCorte()), generacionCargada.getConfiguracion().getFitness().toString(), String.valueOf(generacionCargada.getFitnessPromedio()), String.valueOf(generacionCargada.getFitnessDesviacion()) }); // Carga la tabla de ejecuciones DefaultTableModel dtmEjecucion = (DefaultTableModel) tbEjecuciones.getModel(); limpiarModelo(dtmEjecucion); List<Ejecucion> ejecuciones = generacionCargada.getEjecuciones(); for (Ejecucion ejecucion : ejecuciones) { dtmEjecucion.addRow(new String[] { String.valueOf(ejecuciones.indexOf(ejecucion)), String.valueOf(ejecucion.getFitness()), String.valueOf(ejecucion.getTiempo()) + " ms." }); } // Limpia la tabla de comision DefaultTableModel dtmComision = (DefaultTableModel) tbComision.getModel(); limpiarModelo(dtmComision); }
From source file:com.unsa.view.MainView.java
private void btnSeleccionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSeleccionarActionPerformed // TODO add your handling code here: //JFileChooser file=new JFileChooser(); file = new JFileChooser(); //FileNameExtensionFilter filter = new FileNameExtensionFilter("PDF & DOC & DOCX Files", "pdf", "docx","doc"); FileNameExtensionFilter filter1 = new FileNameExtensionFilter("PDF", "pdf"); FileNameExtensionFilter filter2 = new FileNameExtensionFilter("DOCX, DOC", "docx", "doc"); //FileNameExtensionFilter filter3 = new FileNameExtensionFilter("DOC","doc"); file.setFileFilter(filter1);// w ww . j a va2 s .c om file.setFileFilter(filter2); file.setMultiSelectionEnabled(true); file.showOpenDialog(null); File[] abrir = file.getSelectedFiles(); if (abrir.length == 0) { JOptionPane.showMessageDialog(null, "No seleccion ningun archivo"); return; } txtArchivos.setText(abrir[0].getParent()); String[] lnames = { "Nombre Archivo", "Obs. Dudosa", "Obs. Critica", "Abrir Archivo" }; DefaultTableModel model = new DefaultTableModel(lnames, 0); tableSalida.setModel(model); for (File file2 : abrir) { Object[] data = new Object[4]; data[0] = file2.getName(); data[1] = ""; model.addRow(data); } if (lblInstitucion.getText().equals("") || lblSiglas.getText().equals("") || lblIdioma.getText().equals("")) { btnProcesar.setEnabled(false); } else { btnProcesar.setEnabled(true); } }
From source file:userInteface.Patient.ManageVitalSignsJPanel.java
private void populatePatientsTable(ArrayList<Person> personList) { DefaultTableModel model = (DefaultTableModel) viewPatientsJTable.getModel(); model.setRowCount(0);// ww w. java2 s . c o m if (personList.isEmpty()) { JOptionPane.showMessageDialog(this, "No Persons found. Please add Persons", "Error", JOptionPane.INFORMATION_MESSAGE); return; } for (Person person : personList) { Object[] row = new Object[3]; row[0] = person; row[1] = person.getAge(); if (person.getPatient() != null) { row[2] = person.getPatient().getPatientID(); } else { row[2] = "Patient Not Created"; } model.addRow(row); } }
From source file:musiccrawler.App.java
private void btnCrawlActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCrawlActionPerformed if (Utils.isNull(rdgOptionCrawl.getSelection())) { JOptionPane.showMessageDialog(this, "Plz, check option before perform action crawl"); return;/*from ww w. j a v a 2 s . c o m*/ } String path = txtUrlInput.getText(); if (StringUtils.isEmpty(path)) { lblError.setText("Path is require"); lblError.setForeground(Color.RED); return; } boolean isGetAll = rdbGetAll.isSelected(); path = Validator.validPath(path); final DefaultTableModel defaultTableModel = new DefaultTableModel(isGetAll ? COLUMN_NAMES : COLUMN_STREAM, 0); AtomicInteger count = new AtomicInteger(); if (isGetAll) { List<Music> musics = musicCrawler.crawl(path); if (CollectionUtils.isNotEmpty(musics)) { musics.forEach(music -> { Object[] row = { count.getAndIncrement(), music.getId(), music.getTitle(), music.getImage(), music.getUrl(), music.getLyric(), music.getDescription(), music.getStream(), music.getQualityType().toString(), music.getSinger().getName(), music.getSinger().getAge(), music.getSinger().getDescription(), music.getSinger().getAvatar() }; defaultTableModel.addRow(row); }); } } else { Map<String, List<String>> results = musicCrawler.reCrawlLinkStream(path); List<String> musicIds = results.get("id"); List<String> listStream = results.get("stream"); musicIds.forEach(id -> { int index = count.getAndIncrement(); Object[] row = { index, id, listStream.get(index) }; defaultTableModel.addRow(row); }); } tbResultCrawlOnl.setModel(defaultTableModel); defaultTableModel.fireTableDataChanged(); tbResultCrawlOnl.setVisible(true); }
From source file:UserInterface.FinanceRole.DonateToPoorPeopleJPanel.java
private void populateTransactionTable(Person objPerson) { //Chart//from w w w . j a v a 2s . com 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:gdt.jgui.entity.fields.JFieldsEditor.java
/** * Create a new facet renderer./*from w ww. jav a 2 s. c om*/ * @param console the main console. * @param locator$ the locator string. * @return the fields editor. */ @Override public JFacetRenderer instantiate(JMainConsole console, String locator$) { try { //System.out.println("FieldsEditor.instantiate:begin"); this.console = console; Properties locator = Locator.toProperties(locator$); entihome$ = locator.getProperty(Entigrator.ENTIHOME); entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); requesterResponseLocator$ = locator.getProperty(JRequester.REQUESTER_RESPONSE_LOCATOR); table = new JTable(); DefaultTableModel model = new DefaultTableModel(null, new String[] { "Name", "Value" }); entigrator = console.getEntigrator(entihome$); entity = entigrator.getEntityAtKey(entityKey$); entityLabel$ = entity.getProperty("label"); Core[] ca = entity.elementGet("field"); if (ca != null) for (Core aCa : ca) { model.addRow(new String[] { aCa.name, aCa.value }); } table.setModel(model); scrollPane.setViewportView(table); table.getTableHeader().setDefaultRenderer(new SimpleHeaderRenderer()); table.getTableHeader().addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int col = table.columnAtPoint(e.getPoint()); String name = table.getColumnName(col); // System.out.println("Column index selected " + col + " " + name); sort(name); } }); } catch (Exception e) { LOGGER.severe(e.toString()); } return this; }
From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowserAdvancedFilter.java
private void addContentSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addContentSearchButtonActionPerformed DefaultTableModel model = ((DefaultTableModel) contentSearchTable.getModel()); int row = model.getRowCount(); model.addRow(new Object[] { ContentType.RAW, "" }); contentSearchTable.setRowSelectionInterval(row, row); }
From source file:userInteface.Patient.ManageVitalSignsJPanel.java
private void populateVitalSignTable(Person person) { DefaultTableModel model = (DefaultTableModel) viewVitalSignsJTable.getModel(); model.setRowCount(0);/*from w w w . ja v a2s . co m*/ if (person != null) { int patientAge = person.getAge(); ArrayList<VitalSign> vitalSignList = person.getPatient().getVitalSignHistory().getHistory(); if (vitalSignList.isEmpty()) { JOptionPane.showMessageDialog(this, "No vital signs found. Please add vital signs", "Error", JOptionPane.INFORMATION_MESSAGE); return; } for (VitalSign vitalSign : vitalSignList) { Object[] row = new Object[2]; row[0] = vitalSign; row[1] = VitalSignStatus(patientAge, vitalSign); model.addRow(row); } } }