My question here is fairly simple. Can JTextArea's be set to transparent, but not completely invisible? Also, if it's possible, how can I draw an image behind it (draw the image first, and then draw the transparent text area overtop of it)?
Asked
Active
Viewed 1.0k times
2 Answers
10
1) Override the paintComponent() method of the JTextArea something like:
g.drawImage(...);
super.paintComponent(g);
2) When you create the text area you will need to give it a transparent background:
setBackground( new Color(r, g, b, alpha) );

camickr
- 321,443
- 19
- 166
- 288
0
You could also do this:
jScrollPane.setOpaque(false);
jScrollPane.getViewport().setOpaque(false);
jScrollPane.setBorder(null);
jScrollPane.setViewportBorder(null);
jTextArea.setBorder(null);
jTextArea.setBackground(new Color(0, 0, 0, 0));
jscrollpane is the immediate parent component of the jtextarea.

quicksilver
- 171
- 1
- 4