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 / First Aid / March 2005

Tip: Looking for answers? Try searching our database.

Formatting via JTextArea

Thread view: 
Skysword - 14 Mar 2005 00:14 GMT
Hi there, can anyone tell me how to do the formatting on JTextArea
object, for example I want to store some content in a JTextArea object
like below:
1   Something                          yes
3   something more                     no
2   extra stuff                        yes
somemore words here...............

I used append() to add string into the object,but the layout is
unpleasant. And setText() replaces all strings in the object, since I
need to add strings in one by one, so it doesn't work too.
please help!~
Skysword - 17 Mar 2005 02:48 GMT
Does anyone know it?
Roland - 17 Mar 2005 13:08 GMT
> Hi there, can anyone tell me how to do the formatting on JTextArea
> object, for example I want to store some content in a JTextArea object
[quoted text clipped - 8 lines]
> need to add strings in one by one, so it doesn't work too.
> please help!~

To append text, use JTextArea's append(String) method.

JTextArea is fairly limited for the formatting you require. You could
use a fixed size (monospace) font on the JTextArea, set tab width and
use tabs or spaces to format your data appropriately.

Since your data seems to be in table format, so you might consider using
a JTable instead.
Signature

Regards,

Roland de Ruiter
  ___      ___
 /__/ w_/ /__/
/  \ /_/ /  \



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



©2008 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.