Nadir Abdullayev Nadir Abdullayev - 1 year ago 69
Java Question

How to change the color of | of JTextField

Do you know how to change the color of | which appears and disappears in JTextField? I can't see it because of the dark color of JTextField itself but I don't want to change it, so I want to change the color of |.
P.S. changing color of the foreground doesn't affect this thing. And also how is this thing called ( | ) ?

Answer Source

The missing piece of information you need is that the cursor thingy in a JTextField is called a "caret".

JTextField is a subclass of JTextComponent which has a setCaretColor(...) method you can use.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download