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 / August 2005

Tip: Looking for answers? Try searching our database.

cannot get rid of new lines after getText form JTextArea

Thread view: 
jobs239@hotmail.com - 24 Aug 2005 22:33 GMT
In my GUI application, I have a JTextArea. I type the following

testone
testtwo

Now I do a getText() but I want to get rid of the newline between
testone and testtwo from the returned string. I did the following but
it doesn't work. If I print descrip after replaceAll, it still prints
in two lines.

String descrip = descrip_field.getText();
descrip.replaceAll("\n", "");
Babu Kalakrishnan - 24 Aug 2005 22:38 GMT
> In my GUI application, I have a JTextArea. I type the following
>
[quoted text clipped - 8 lines]
> String descrip = descrip_field.getText();
> descrip.replaceAll("\n", "");

Strings are immutable objects. You should be using the String that is
returned as the result of the replaceAll call.

BK
jobs239@hotmail.com - 24 Aug 2005 22:57 GMT
Thanks!
I used the returned string and it worked.


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.