Start editing in a cell in JTable on gaining focus
I have defined cell editors for the two columns in my table in the following manner:
The problem I am facing is that when a focus is moved to a table cell, the cell doesn't become automatically editable. So, when the focus is moved to column 2 (that has a text field as an editor), the caret sign doesn't not appear unless the cell is double-clicked or the user starts typing. Similar is the case for column 1 (that has a combo box as an editor) as here the combo box doesn't appear unless the cell is clicked. These behaviors are counter-intuitive and undesirable for a user operating with the keyboard.:(
JComboBox combo = new JComboBox();
//code to add items to the combo box goes here.
JTextField textField = new JTextField();
TableColumn column = myJTable.getColumnModel().getColumn(0);
column = myJTable.getColumnModel().getColumn(1);
Please suggest pointers on how this could be resolved.
Thanks in advance.
solved : start editing in a cell in JTable on gaining focus
Your code worked perfectly, and the issue is resolved!!! :)
Many Thanks for that.