Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: printing textarea & removing \n

Reply
Thread Tools

Re: printing textarea & removing \n

 
 
Daniel =?iso-8859-1?Q?Sj=F6blom?=
Guest
Posts: n/a
 
      06-27-2003
Kyle Walz wrote:
>
> What should I replace \n with when printing a textarea? Want to
> remove or replace [] (the box representing \n) with whatever tells the
> printer to go to the next line. The app uses Swing and I use JB7 with
> 1.3.1.
>
> String texttoprint = ta.getText();
> texttoprint.replace('\n',' '); // <-- need improvement here
> g2.setPaint(Color.black);
> g2.drawString(texttoprint, 96, 144);


Try \r\n. I think \n should work too, but it probably depends on your
printer.

 
Reply With Quote
 
 
 
 
Daniel =?iso-8859-1?Q?Sj=F6blom?=
Guest
Posts: n/a
 
      06-27-2003
Daniel Sjöblom wrote:
>
> Kyle Walz wrote:
> >
> > What should I replace \n with when printing a textarea? Want to
> > remove or replace [] (the box representing \n) with whatever tells the
> > printer to go to the next line. The app uses Swing and I use JB7 with
> > 1.3.1.
> >
> > String texttoprint = ta.getText();
> > texttoprint.replace('\n',' '); // <-- need improvement here
> > g2.setPaint(Color.black);
> > g2.drawString(texttoprint, 96, 144);

>
> Try \r\n. I think \n should work too, but it probably depends on your
> printer.


Oh, and you probably want to use the replaceAll method instead of
replace.

 
Reply With Quote
 
 
 
 
Kyle Walz
Guest
Posts: n/a
 
      06-27-2003
Thanks for the tips.

I'll try my own replace method. Haven't checked if JBuilder 8 is free
yet--no money to spend.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:28 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-18-2007 10:11 AM
How to add </textarea> within <textarea> tags? frank.moens@gmail.com Javascript 1 07-04-2007 04:00 PM
Textarea Inside of a textarea wperry1@gmail.com ASP General 6 02-05-2006 08:00 AM
Removing carriage returns from <textarea></textarea> input Augustus ASP General 1 09-10-2003 04:55 AM



Advertisments