-
-
Notifications
You must be signed in to change notification settings - Fork 321
Description
In FlatTextAreaUI.createCaret() the call is made new FlatCaret( null, false ); setting the selectAllOnFocusPolicy to the default. Yet in FlatTextFieldUI.createCaret() the call reads new FlatCaret( "TextComponent.selectAllOnFocusPolicy"), UIManager.getBoolean( "TextComponent.selectAllOnMouseClick" ) );. I think the two calls should be the same; in fact, maybe the two classes should be inheriting a common base class that implements createCaret (and other common methods on text components).
As it stands, JTextArea will always select the text on first focus gained because that is the default behavior and there is no way to change this. JTextField is configurable with the TextComponent.selectAllOnFocusPolicy. I think the policy should apply to JTextArea, too. If not, then a similar configuration options for JTextArea is warranted.
I have a hard time imagining developers wanting to change the policy on JTextField but not JTextArea, so I believe this constitutes a bug and can safely be changed. If differing configurability between the two is desired, then having a separate option seems acceptable. Though I recognize it's more difficult to add a separate option than to use the existing one. Having a separate option also adds complexity to the usability of the code.