I am trying to programatically select and edit a cell in a JTable. The cell editor and renderer are JTextField components. My code is as follows:
What I get is a cell that appears selected, but the cursor is not present. If I type, text is added to the end of the text field, but still no cursor. If I click the cell, the cursor appears where I click and when I type, text appears at the point of the cursor within the text string. What I want is to have the cell selected (current behavior) AND have the cursor appear at the end of the text string in the cell, ready for editing. Additionally, I'd like the entire text to be selected within the cell so typing replaces the current text.
Try setCaretPostition (or other related methods) from JTextComponent. Bill
Joined: Oct 22, 2002
Thanks for the reply. I tried this and got the same results. I think that the problem is with the actual "selection" vs "editing" state of the cell. If it's editing, then the caret should be visible, shouldn't it? It's almost like some event that needs to be fired, isn't. [ November 05, 2002: Message edited by: Gil Estes ]