List of usage examples for javax.swing.table DefaultTableModel removeRow
public void removeRow(int row)
row
from the model. From source file:com.mirth.connect.connectors.vm.ChannelWriter.java
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed int rowSelectionNumber = mapVariablesTable.getSelectedModelIndex(); if (rowSelectionNumber > -1) { DefaultTableModel model = (DefaultTableModel) mapVariablesTable.getModel(); int viewSelectionRow = mapVariablesTable.convertRowIndexToView(rowSelectionNumber); model.removeRow(rowSelectionNumber); if (mapVariablesTable.getRowCount() != 0) { if (viewSelectionRow == 0) { mapVariablesTable.setRowSelectionInterval(0, 0); } else if (viewSelectionRow == mapVariablesTable.getRowCount()) { viewSelectionRow--;/*from w w w. jav a2s . c o m*/ mapVariablesTable.setRowSelectionInterval(viewSelectionRow, viewSelectionRow); } else { mapVariablesTable.setRowSelectionInterval(viewSelectionRow, viewSelectionRow); } } deleteButton.setEnabled((mapVariablesTable.getRowCount() != 0)); parent.setSaveEnabled(true); } }
From source file:TableSorter.java
public void removeRow(int row) { // NO_UCD DefaultTableModel tm = (DefaultTableModel) getTableModel(); tm.removeRow(row); fireTableDataChanged();//from ww w . ja v a2 s . c o m }
From source file:view.ResultsPanel.java
public void setTable(int nbMode, List<ElementaryMode> modes) { ElementaryMode mode = modes.get(nbMode); DefaultTableModel model = (DefaultTableModel) modeTable.getModel(); while (model.getRowCount() > 0) { model.removeRow(0); }/*w w w . ja v a 2 s . c o m*/ Map<Reaction, Double> map = mode.getContent(); for (Reaction key : map.keySet()) { model.addRow(new Object[] { map.get(key), key.getName(), key.getStringReaction() }); } final TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(modeTable.getModel()); modeTable.setRowSorter(sorter); modeTable.getTableHeader().setReorderingAllowed(false); searchField.getDocument().addDocumentListener(new MyDocumentListener(searchField, sorter, 1, 2)); searchField.setText(searchField.getText()); }
From source file:dbseer.gui.panel.DBSeerLiveMonitorPanel.java
public void reset() { synchronized (LiveMonitorInfo.LOCK) { DefaultTableModel model = (DefaultTableModel) monitorTable.getModel(); int rowCount = model.getRowCount(); for (int i = rowCount - 1; i >= 2; --i) { model.removeRow(i); }//from www .j av a2 s. c o m latencyCollection.removeAllSeries(); throughputCollection.removeAllSeries(); for (JLabel label : transactionLabels) { transactionTypesPanel.remove(label); } transactionLabels.clear(); for (JButton button : transactionRenameButtons) { transactionTypesPanel.remove(button); } transactionRenameButtons.clear(); for (JButton button : transactionViewSampleButtons) { transactionTypesPanel.remove(button); } transactionViewSampleButtons.clear(); for (JButton button : transactionEnableDisableButtons) { transactionTypesPanel.remove(button); } transactionEnableDisableButtons.clear(); transactionNames.clear(); numTransactionType = 0; setTotalNumberOfTransactions(0.0); setCurrentTPS(0.0); } this.invalidate(); this.repaint(); }
From source file:view.caja.Despacho.java
public void quitarTodo() { //System.out.println("#Items:"+tbCarrito.getRowCount()); if (tbCarrito.getRowCount() != 0) { DefaultTableModel defModel = (DefaultTableModel) tbCarrito.getModel(); for (int indexTable = tbCarrito.getRowCount() - 1; indexTable >= 0; indexTable--) { defModel.removeRow(indexTable); }//from w ww .jav a2s . com contador = 0; jlblCantMostrar.setText(Integer.toString(contador)); aCobrar = 0; jlblACobrarMostrar.setText(Double.toString(aCobrar)); btRemoveAll.setEnabled(false); if (tbCarrito.getRowCount() == 0) { btQuitar.setEnabled(false); } aCobrar = 0; jlblACobrarMostrar.setText(Double.toString(aCobrar)); System.out.println(aCobrar); } else { //System.out.println("nada que quitar"); btRemoveAll.setEnabled(false); } }
From source file:ca.uviccscu.lp.server.main.MainFrame.java
public static void wipeGameTableRows() { DefaultTableModel md = (DefaultTableModel) jTable1.getModel(); int lim = md.getRowCount(); for (int i = 0; i < lim; i++) { md.removeRow(0); }/*from w w w.j a v a 2s . c o m*/ }
From source file:ca.uviccscu.lp.server.main.MainFrame.java
public static void wipeNetworkTableRows() { DefaultTableModel md = (DefaultTableModel) jTable2.getModel(); int lim = md.getRowCount(); for (int i = 0; i < lim; i++) { md.removeRow(0); }//w w w . j a v a2 s . c o m }
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 a2s.co 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 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:com.ftb2om2.view.MultiplePane.java
private void removeDifficultyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeDifficultyActionPerformed int[] rows = difficultyTable.getSelectedRows(); DefaultTableModel model = (DefaultTableModel) difficultyTable.getModel(); Arrays.sort(rows);// ww w . ja v a 2 s. com for (int i = rows.length - 1; i >= 0; i--) { model.removeRow(rows[i]); model.fireTableRowsDeleted(rows[i], rows[i]); } }
From source file:view.ResultsPanel.java
public void displayFrame(final List<ElementaryMode> modes, final List<Integer> indices) { this.removeAll(); DefaultTableModel model = (DefaultTableModel) modeTable.getModel(); while (model.getRowCount() > 0) { model.removeRow(0); }/* w ww.j av a 2 s .c om*/ if (modes.size() > 0) { setTable(0, modes); } JLabel nbMod = new JLabel(modes.size() + " mode(s) found"); toolbar = new JToolBar(); // set elements in the toolbar toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.LINE_AXIS)); toolbar.add(nbMod); toolbar.setFloatable(false); Object[] comboElements = new Object[modes.size()]; for (int i = 0; i < modes.size(); i++) { comboElements[i] = "mode " + indices.get(i); } modesCombo = new JComboBox(comboElements); if (modesCombo.getActionListeners().length > 0) { modesCombo.removeActionListener(modesCombo.getActionListeners()[0]); } modesCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setTable(modesCombo.getSelectedIndex(), modes); } }); if (modes.size() > 0) { toolbar.add(modesCombo); } modesCombo.setMaximumSize(new Dimension(100, 30)); //we put the right size for le comboBox int sizeMax = String.valueOf(modes.size()).length(); String stringMax = "mode "; for (int i = 0; i < sizeMax; i++) { stringMax += "X"; } modesCombo.setPrototypeDisplayValue(stringMax); if (download.getActionListeners().length > 0) { download.removeActionListener(download.getActionListeners()[0]); } download.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread thread = new DownloadContentThread(modes, controler, command, log.getText()); thread.start(); } }); if (histoButton.getActionListeners().length > 0) { histoButton.removeActionListener(histoButton.getActionListeners()[0]); } histoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { showHistogram(modes); } }); toolbar.add(histoButton); toolbar.add(filterButton); toolbar.add(download); toolbar.add(scriptButton); if (!isAttached) { toolbar.add(addToProject); } else { toolbar.add(removeFromProject); } toolbar.add(Box.createHorizontalGlue()); toolbar.add(searchField); toolbar.add(new JLabel(Var.iconsearch)); JPanel logPanel = new JPanel(new BorderLayout()); logPanel.add(new JLabel("Generetad log", JLabel.CENTER), BorderLayout.PAGE_START); logPanel.add(new JScrollPane(log), BorderLayout.CENTER); this.setLayout(new BorderLayout()); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(modeTable), logPanel); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(500); add(toolbar, BorderLayout.PAGE_START); this.add(splitPane, BorderLayout.CENTER); this.revalidate(); this.repaint(); }