Nadir Abdullayev Nadir Abdullayev - 9 months ago 27
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.