List of usage examples for javax.swing.table DefaultTableModel addRow
public void addRow(Object[] rowData)
From source file:latexstudio.editor.DropboxRevisionsTopComponent.java
public void updateRevisionsList(String path) { DbxClient client = DbxUtil.getDbxClient(); List<DbxEntry.File> entries = null; if (path != null) { try {/*from ww w.j a v a2s. co m*/ entries = client.getRevisions(path); } catch (DbxException ex) { DbxUtil.showDbxAccessDeniedPrompt(); } } dlm.clear(); DefaultTableModel model = new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { return column == REVIEW_COLUMN; } }; model.addColumn(REVISION_COLUMN_NAME); model.addColumn(MODIFIED_COLUMN_NAME); model.addColumn(FILE_SIZE_COLUMN_NAME); model.addColumn(REVIEW_COLUMN_NAME); if (entries != null && entries.size() > 0) { for (DbxEntry.File dbxEntry : entries) { dlm.addElement(new DbxEntryRevision(dbxEntry)); model.addRow(new Object[] { dbxEntry.rev, dbxEntry.lastModified, dbxEntry.humanSize, REVIEW_BUTTON_LABEL }); } } Action showVersion = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { // Resolving which row has been double-clicked JTable table = (JTable) e.getSource(); int row = Integer.valueOf(e.getActionCommand()); // Finding revision using information from the clicked row String revisionNumber = table.getValueAt(row, REVISION_COLUMN).toString(); loadRevision(revisionNumber); } }; jTable1.setModel(model); ButtonColumn buttonColumn = new ButtonColumn(jTable1, showVersion, REVIEW_COLUMN); buttonColumn.setMnemonic(KeyEvent.VK_D); }
From source file:frames.MainGUI.java
private void addRowToResidentInfoTable(Resident r) { DefaultTableModel model = (DefaultTableModel) this.jTable1.getModel(); model.addRow(new Object[] { r.name, String.valueOf(r.basic_rent) }); }
From source file:frames.MainGUI.java
private void addItemToFeeTable(String s1, String s2, String s3, String s4) { DefaultTableModel model = (DefaultTableModel) this.jTable2.getModel(); model.addRow(new Object[] { s1, s2, s3, s4 }); }
From source file:userInterface.DistrictAdminRole.MonitorNeighborhoodAreasJPanel.java
public void populateHealthyFamily(Person person) { DefaultTableModel model = (DefaultTableModel) hFamilesTable.getModel(); model.setRowCount(0);//from w ww.j a v a2 s . c o m for (Person p : healthyFamily) { Object[] row = new Object[1]; row[0] = p; model.addRow(row); } }
From source file:userInterface.DistrictAdminRole.MonitorNeighborhoodAreasJPanel.java
public void populateEfficientFamily(Person person) { DefaultTableModel model = (DefaultTableModel) efFamilesTable.getModel(); model.setRowCount(0);// w ww. j ava 2s. c om for (Person p : efficientHouse) { Object[] row = new Object[1]; row[0] = p; model.addRow(row); } }
From source file:userInterface.DistrictAdminRole.MonitorNeighborhoodAreasJPanel.java
public void populateunHealthyFamily(Person person) { DefaultTableModel model = (DefaultTableModel) uhFamilesTable.getModel(); model.setRowCount(0);// w w w .java 2s.co m for (Person p : unHealthyFamily) { Object[] row = new Object[1]; row[0] = p; model.addRow(row); } }
From source file:userInterface.DistrictAdminRole.MonitorNeighborhoodAreasJPanel.java
public void populateUnEfficientFamily(Person person) { DefaultTableModel model = (DefaultTableModel) unefFamilesTable.getModel(); model.setRowCount(0);//from w w w . j ava 2 s. c om for (Person p : unefficientHouse) { Object[] row = new Object[1]; row[0] = p; model.addRow(row); } }
From source file:gtu._work.ui.PropertyEditUI.java
void loadPropertiesToModel(Properties prop) { DefaultTableModel model = JTableUtil.createModel(false, "index", "key", "value"); String value = null;// w w w. ja v a2 s .c o m int index = 0; for (String key : prop.stringPropertyNames()) { value = prop.getProperty(key); model.addRow(new Object[] { index++, key, getChs2Big5(value) }); } propTable.setModel(model); }
From source file:boundary.ReportProduce.java
public void setTable() { DefaultTableModel model = new DefaultTableModel(); jTable1.setModel(model);// ww w . ja v a2 s .c o m model.addColumn("No."); model.addColumn("Title"); model.addColumn("Status"); model.addColumn("Recording Session No."); model.addColumn("Recording Date"); for (Map.Entry<Integer, ArrayList<Object>> entry : ReportProduceControl .getRecordings(String.valueOf(jComboBox1.getSelectedItem())).entrySet()) { Integer key = entry.getKey(); ArrayList<Object> value = entry.getValue(); value.add(0, key); model.addRow(value.toArray()); } jTable1.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (jTable1.getSelectedRow() > -1) { setSoundmanTbl((String) jTable1.getValueAt(jTable1.getSelectedRow(), 3)); setMusicianTbl((String) jTable1.getValueAt(jTable1.getSelectedRow(), 3)); } } }); }
From source file:com.ftb2om2.view.MultiplePane.java
private void difficultyTableDragAndDrop(DropTargetDropEvent evt) { try {/*from ww w . j a v a 2 s.c o m*/ DefaultTableModel model = (DefaultTableModel) difficultyTable.getModel(); evt.acceptDrop(DnDConstants.ACTION_COPY); List<File> droppedFile = (List<File>) evt.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); droppedFile.forEach(file -> model.addRow( new Object[] { file.getName(), file.getPath(), FilenameUtils.getBaseName(file.getPath()) })); } catch (Exception ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.INFO, null, ex); } }