Hi all,
I want to display text on the screen, I would normally use a JLabel but I
want this text to span over about 3 lines. I am trying to use a JTextArea
but I want the background to be transparent, like the JLabels. I can not
find anywhere in the API on how to do this. Any help or alternative ideas to
using JTextArea would be greatly appreciated.
Many thanks
Ed Keen
Alexandre Campos Hermida - 23 Jan 2004 12:15 GMT
You can try doing something like:
import javax.swing.*;
public class Test{
public static void main(String[] args){
JFrame frame = new JFrame();
JTextArea a = new JTextArea();
a.setBorder(null);
a.setBackground(frame.getContentPane().getBackground());
frame.getContentPane().add(a);
frame.pack();
frame.show();
}
}
//Hermida
>Hi all,
>I want to display text on the screen, I would normally use a JLabel but I
[quoted text clipped - 6 lines]
>
>Ed Keen
Christian Kaufhold - 23 Jan 2004 17:18 GMT
> I want to display text on the screen, I would normally use a JLabel but I
> want this text to span over about 3 lines. I am trying to use a JTextArea
> but I want the background to be transparent, like the JLabels. I can not
> find anywhere in the API on how to do this. Any help or alternative ideas to
> using JTextArea would be greatly appreciated.
textArea.setOpaque(false);
Christian

Signature
http://www.chka.de/swing/components/opacity.html
epbk2 - 23 Jan 2004 17:37 GMT
Worked a treat. Thanks for your help.
Ed
> textArea.setOpaque(false);