i want to display a textarea decribing the value of a node ( a graph project) but whenever i select the text it gets messy so i want it to be unsectable ! this is the code :
public class TransparentTextArea extends JTextArea {
String texte;
public TransparentTextArea(String texte) {
this.setLineWrap(true);
this.setWrapStyleWord(true);
this.texte = texte;
this.setBackground(new Color(255, 0, 9, 0));
this.setFont(new Font("Serif", Font.ITALIC, 24));
this.setEditable(false);
this.setText(texte);
this.setSize(new Dimension(200,100 ));
}
}
thx
It's somehow old question but for those who still care, disabling the JTextArea
is not very helpful, mostly because of the gray color of the foreground. The best thing to do, is to nullify the highlighter:
setHighlighter(null)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With