I'm writing a search & replace function in a kind of spreadsheet program. What I want is that if you search for a string, the program shows a table with the element that has been found.
So far so good, but I cannot get the element to obtain the focus, with the cursor in it so you can immediately start typing.
I'm using a customized JTable and also a customized TableCellEditor. The following tricks do not seem to work: (within the customized TableCellEditor):
SwingUtilities.invokeLater(new Runnable() {
public void run() {
my_textfield.requestFocus();
}
} );
or:
my_jtable.editCellAt(0, 3);
my_jtable.requestFocus();
or
my_jtable.getEditorComponent().requestFocusInWindow();
Am I missing something? Is there a good description (nice flow diagram) that shows how events take place? Or example code that might do something similar?