Displaying multi-line text  
Author Message
epbk2





PostPosted: 2004-1-24 1:04:00 Top

java-programmer, Displaying multi-line text 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





PostPosted: 2004-1-23 20:16:00 Top

java-programmer >> Displaying multi-line text

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
epbk2 wrote:

>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
>
>
>
>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
You can try doing something like:<br>
<br>
import javax.swing.*;<br>
<br>
public class Test{<br>
  public static void main(String[] args){<br>
    JFrame frame = new JFrame();<br>
    JTextArea a = new JTextArea();<br>
   <b> a.setBorder(null);<br>
    a.setBackground(frame.getContentPane().getBackground());</b><br>
    frame.getContentPane().add(a);<br>
    frame.pack();<br>
    frame.show();<br>
  }<br>
}<br>
<br>
//Hermida<br>
epbk2 wrote:<br>
<blockquote type="cite" cite="midburk54$me4$email***@***.com">
<pre wrap="">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


</pre>
</blockquote>
<br>
</body>
</html>

 
usenet





PostPosted: 2004-1-24 1:18:00 Top

java-programmer >> Displaying multi-line text epbk2 <email***@***.com> wrote:

> 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
--
http://www.chka.de/swing/components/opacity.html
 
 
epbk2





PostPosted: 2004-1-24 1:37:00 Top

java-programmer >> Displaying multi-line text Worked a treat. Thanks for your help.

Ed

"Christian Kaufhold" <email***@***.com> wrote in message
news:email***@***.com...

>
> textArea.setOpaque(false);
>