JTable myTable = new javax.swing.JTable() { public void changeSelection(final int row, final int column, boolean toggle, boolean extend) { super.changeSelection(row, column, toggle, extend); myTable.editCellAt(row, column); myTable.transferFocus(); } };
/** * Several methods are called, e.g. editCellAt, to get the focus set in the * value column of the specified row. The attribute column has the * parameter name and should not receive focus. */ protected void setTableCellFocus(int row) { propertyTable.editCellAt(row, 1); TableCellEditor editor = propertyTable.getCellEditor(row, 1); Component comp = editor.getTableCellEditorComponent( propertyTable, propertyTable.getValueAt(row, 1), true, row, 1); }
stringRenderer.setBackground(new java.awt.Color(221, 221, 221)); if (isSelected && hasFocus) { table.editCellAt(row, 1);
@Override public boolean editCellAt(final int row, final int column) { final boolean editCellAt = super.editCellAt(row, column); if (editCellAt) { // getEditorComponent().requestFocus(); } return editCellAt; }
public boolean editCellAt(int row, int column, EventObject e) { boolean result = super.editCellAt(row, column, e); if (isSelectAllForMouseEvent || isSelectAllForActionEvent || isSelectAllForKeyEvent) { selectAll(e); } return result; }
public boolean editCellAt(int row, int column, EventObject e) { boolean result = super.editCellAt(row, column, e); if (isSelectAllForMouseEvent || isSelectAllForActionEvent || isSelectAllForKeyEvent) { selectAll(e); } return result; }
/** * Focusses on the editor * * @see javax.swing.JTable#editCellAt */ public boolean editCellAt(int row, int column) { boolean editCellAt = super.editCellAt(row, column); requestFocus(); return editCellAt; }
@Override public void actionPerformed(ActionEvent e) { JTable table = CsvTableEditorKeyListener.this.csvTableEditor.getTable(); if (table.getSelectedRow() != -1 && table.getSelectedRow() != -1) { table.editCellAt(table.getSelectedRow(), table.getSelectedColumn()); } } }
public void actionPerformed(ActionEvent e) { data.add(""); model.fireTableDataChanged(); dialog.table.changeSelection(data.size() - 1, 0, false, false); dialog.table.editCellAt(data.size() - 1, 0); dialog.table.transferFocus(); } });
public boolean editCellAt(final int _row, final int _column, final EventObject _e){ if(getCursor()==TableColumnResizer.resizeCursor || getCursor()==TableRowResizer.RESIZE_CURSOR) { return false; } return super.editCellAt(_row, _column, _e); }
/** * It forces the selected table row to be edited. */ private void forceSelectedTraceEdit() { int selectedRowIndex = getSelectedRow(); if (selectedRowIndex > -1) { assert 0 <= selectedRowIndex && selectedRowIndex < gcTraceSet.size(); table.editCellAt(selectedRowIndex, 0); } }
@Override public void actionPerformed(ActionEvent e) { invokeOriginalAction(e); int row = table.getSelectedRow(); int column = table.getSelectedColumn(); if (table.isCellEditable(row, column)) { table.editCellAt(row, column, e); } } }
@Override public void dispose() { table.editCellAt(0,0); super.dispose(); updaterFrame.updateFilesTable(); updaterFrame.enableApplyOrUpload(); updaterFrame.addCustomViewOptions(); }
private static void autoEdit(JTable tab) { if (tab.editCellAt(tab.getSelectedRow(), tab.getSelectedColumn(), null) && tab.getEditorComponent() != null) { JTextField field = (JTextField) tab.getEditorComponent(); field.setCaretPosition(field.getText().length()); field.requestFocusInWindow(); field.selectAll(); } }
private void editCellInAWT() { if (table.editCellAt(row1, column1)) { Component editor = table.getEditorComponent(); editor.requestFocusInWindow(); if (editor instanceof JTextField && field == null) { addMoveCellAction((JTextField) editor); } } }
/** * Overridden to invoke repaint for the particular location if * the column contains the tree. This is done as the tree editor does * not fill the bounds of the cell, we need the renderer to paint * the tree in the background, and then draw the editor over it. */ public boolean editCellAt(int row, int column, EventObject e){ boolean retValue = super.editCellAt(row, column, e); if (retValue && getColumnClass(column) == TreeTableModel.class) { repaint(getCellRect(row, column, false)); } return retValue; }
public void run() { final JTable table = getTable(); table.editCellAt(row, column); Component editorComponent = table.getEditorComponent(); editorComponent.requestFocus(); } });
@Override protected void editRow() { this.getMainList().editCellAt(this.getMainList().getSelectedRow(), this.getMainList().getSelectedColumn()); }
return super.editCellAt(row, tableCol, e);
private void addNew() { add(new UpdateSite(makeUniqueSiteName("New"), "", "", "", null, null, 0l)); table.changeSelection( table.getRowCount()-1, 2, false, false); if (table.editCellAt(table.getRowCount()-1, 2)) { Component editor = table.getEditorComponent(); editor.requestFocusInWindow(); } }