How to change the color of the blinking cursor?

I do not know whether this is possible or not?

But I want to change this cursor to a flashing color ... which is usually black ....

I am doing one project based on java-swing, and in this ... one of the requirements is changing the color of the blink cursor ....

Is this possible?

+3
source share
1 answer

A “cursor” is used to indicate a mouse cursor that is not blinking.

So, I assume that you are talking about a carriage that is used in a text component:

textField.setCaretColor(...);

Edit:

The above sentence does this for a single text field. To change it for all text fields, you should use the following at the beginning of your program:

UIManager.put("TextField.caretForeground", new ColorUIResource(...));
+8

Source: https://habr.com/ru/post/1745223/


All Articles