Client Property は使ってもよいのか?
JDK1.6 update 11 にて.
Swing の JTable で CellEditor の細かい制御をしようとしたとき,以下のようなプロパティを見つけた.
// FocusLost のタイミングで CellEditor を閉じる table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); // JTable のオートエディットを OFF にする table.putClientProperty("JTable.autoStartsEdit", Boolean.FALSE);
terminateEditOnFocusLost は以下のサイトで紹介されていた.
http://terai.xrea.jp/Swing/TerminateEdit.html
JTable.autoStartsEdit は,キー入力で勝手に Editing 状態になる原因を探っていたら,コードの中で見つけた.
(↑ CellEditor が TextField であれば便利だけど,それ以外の場合は切りたくなるときもある)
(ここでも紹介されている → http://terai.xrea.jp/Swing/PreventStartCellEditing.html)
これらの値はおそらく非公開で,使わないほうがよいんだと思う.
でも,JTable.autoStartsEdit のほうは使えないと困る.
だって if の条件式にそのまま使われているんだもの.
(boolean JTable#processKeyBinding(KeyStroke, KeyEvent, int, boolean) のあたり)