mayy00
mayy00

Reputation: 224

JTextArea making text invisible

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

Answers (1)

vgel
vgel

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

Related Questions