Is there any way to hide the cursor in the JTextField and show the
cursor when I click this field? It'd be great if I click other area
or components in the panel, hide the cursor in the JTextField again.
Thanks a lot.
Roy
Which cursor? Mouse? Insert caret?
It is the insert caret.
Your comments do not make much sense to me.
There is an applet here that will pop a dialog with a
JTextField and JTextArea (click the 'Input' button).
<http://www.physci.org/test/resize/>
The 'insert caret' (as I understand it) will only show in
the text field/area that currently has focus, in either the
Metal or System (Win) PLAFs.
To hide the insert caret even when it is in a particular
text widget, just set the widget uneditable or disabled
(see dropdown on main applet GUI).
--
Andrew Thompson
http://www.physci.org/
Message posted via http://www.javakb.com
Thanks a lot. I happened to setFocusable(false) for all other
components. So the JTextField is the only component that always has
focus. That is why the insert caret is always blinking.
Anway, I was told by a friend that a simple way to hide the caret in
this situation is to do the following:
MyTextField.getCaret().setVisible(false);
Thanks again.
Roy
> MyTextField.getCaret().setVisible(false);
I was going to suggest the same thing Andrew did. I didn't know about
this method, good find, thanks!