Reputation: 224
I want my JTextArea to show only the caret. I've setted my JTextArea to not opaque but I couldn't hide the text. How do I achieve this
JTextArea text = new JTextArea();
text.setOpaque(false);//This doesn't make text transparent
Upvotes: 1
Views: 2704
Reputation: 3335
This code:
JTextArea a = new JTextArea();
a.setText("hello, world!");
a.setForeground(new Color(0, 0, 0, 0));
seemed to work fine when I tested it, it made both set text and typed text invisible.
Upvotes: 2