On Jun 30, 2008, at 4:58 AM, Tilman Bender wrote:
...
So far so good. The last requirement is the one that causes me a headache:
On windows it works with the code I already have above.
On Mac OS X 10.5 the following problem occurs:
1.I got to the cell
2.I type 'a'
3.editor is activated, 'a' is filled into the TextComponent (I use JFormattedTextField), but it is selected and therefore overwritten by the following characters, when I type 'bc'. This automatic selectAll seems to be a feature in Java for Leopard:
http://developer.apple.com/releasenotes/Java/JavaLeopardRN/ResolvedIssues/chapter_3_section_5.html#4890361
Does anyone know how I can fix this? Any properties to switch or something?
You can override this behavior with the following: textfield.setCaret(new DefaultCaret()). We install a custom Aqua caret in every text field to modify the default selection behavior provided by Swing to match the native behavior of Mac OS X text widgets. If you are doing any sort of advanced selection manipulation, you might want to look into installing your own custom subclass of DefaultCaret as well.
Cheers,
Mike Swingler
Java Runtime Engineer
Apple Inc.