Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2004

Tip: Looking for answers? Try searching our database.

Displaying multi-line text

Thread view: 
epbk2 - 23 Jan 2004 17:03 GMT
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);


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.