Posted by tech on
October 20, 2009
 Loading ...
|
|
I am guessing this is quite a common problem that programmers encounter when they have JTextField objects inside a JTable. When you click on a cell, it would not select all the text in it. You have to double click it first. Even the DefaultCellEditor’s setClickCountToStart(1) method does not help. The workaround for this is to override the shouldSelectCell() method.
1
2
3
4
5
| @Override
public boolean shouldSelectCell(EventObject eo) {
((JTextField) getComponent()).selectAll();
return super.shouldSelectCell(eo);
} |
Found this post useful? Buy me a cup of coffee or help support the sponsors on the right.
October 21st, 2009 at 3:10 am
sayangnya aq g bisa bahasa inggris… jadi bingung harus coment apa…