Java Code Examples for javax.swing.JTable#editCellAt()
The following examples show how to use
javax.swing.JTable#editCellAt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseTable.java From netbeans with Apache License 2.0 | 6 votes |
public void actionPerformed(ActionEvent ae) { JTable jt = (JTable) ae.getSource(); int row = jt.getSelectedRow(); int col = jt.getSelectedColumn(); if ((row != -1) && (col != -1)) { if (PropUtils.isLoggable(BaseTable.class)) { PropUtils.log(BaseTable.class, "Starting edit due to key event for row " + row); //NOI18N } jt.editCellAt(row, 1, null); //Focus will be rerouted to the editor via this call: jt.requestFocus(); } }
Example 2
Source File: PropertySheetTable.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void actionPerformed(ActionEvent e) { JTable table = (JTable)e.getSource(); if (!table.hasFocus()) { CellEditor cellEditor = table.getCellEditor(); if (cellEditor != null && !cellEditor.stopCellEditing()) { return; } table.requestFocus(); return; } ListSelectionModel rsm = table.getSelectionModel(); int anchorRow = rsm.getAnchorSelectionIndex(); table.editCellAt(anchorRow, PropertySheetTableModel.VALUE_COLUMN); Component editorComp = table.getEditorComponent(); if (editorComp != null) { editorComp.requestFocus(); } }
Example 3
Source File: StatTableModel.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
private void startEditingNextRow(final JTable statsTable, final int col, final int nextRow, JTextField textField) { if (nextRow >= 0 && nextRow < getRowCount() && col >= 0 && col < getColumnCount()) { statsTable.editCellAt(nextRow, col); textField.requestFocusInWindow(); } }
Example 4
Source File: StatTableModel.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
private void startEditingNextRow(final JTable statsTable, final int col, final int nextRow, JTextField textField) { if (nextRow >= 0 && nextRow < getRowCount() && col >= 0 && col < getColumnCount()) { statsTable.editCellAt(nextRow, col); textField.requestFocusInWindow(); } }
Example 5
Source File: MergeResultsGuiTest.java From jmeter-plugins with Apache License 2.0 | 5 votes |
@Test public void testActionPerformed_Add_Copy_Delete_SaveConfig() { System.out.println("actionPerformed"); MergeResultsGui instance = new MergeResultsGui(); JTable grid = instance.getGrid(); ActionEvent actionAdd = new ActionEvent(new JButton(), 1, "add"); ActionEvent actionCopy = new ActionEvent(new JButton(), 2, "copy"); ActionEvent actionDelete = new ActionEvent(new JButton(), 3, "delete"); ActionEvent actionSaveConfig = new ActionEvent(new JButton(), 4, "save_config"); instance.actionPerformed(actionAdd); grid.editCellAt(0, 0); instance.actionPerformed(actionAdd); instance.actionPerformed(actionAdd); instance.actionPerformed(actionAdd); instance.actionPerformed(actionAdd); instance.actionPerformed(actionDelete); grid.editCellAt(0, 0); instance.actionPerformed(actionDelete); instance.actionPerformed(actionDelete); instance.actionPerformed(actionDelete); instance.actionPerformed(actionDelete); instance.actionPerformed(actionCopy); instance.actionPerformed(actionAdd); instance.actionPerformed(actionCopy); grid.editCellAt(0, 0); instance.actionPerformed(actionCopy); instance.actionPerformed(actionCopy); instance.actionPerformed(actionCopy); }
Example 6
Source File: InnerTablePanel.java From netbeans with Apache License 2.0 | 4 votes |
private void stopCellEditing(final JTable table) { table.editCellAt(-1, -1); // finish possible editing }
Example 7
Source File: InnerTablePanel.java From netbeans with Apache License 2.0 | 4 votes |
private void stopCellEditing(final JTable table) { table.editCellAt(-1, -1); // finish possible editing }