Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JTextField automatic selectAll and CellEditor



Thanks a lot for your quick reply Mike!

The proposed solution works perfectly :-)
Issue solved! (after two days of struggling)


2008/7/1 Mike Swingler <email@hidden>:
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.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.