Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Re: printing textarea & removing \n (http://www.velocityreviews.com/forums/t123766-re-printing-textarea-and-removing-n.html)

Daniel =?iso-8859-1?Q?Sj=F6blom?= 06-27-2003 05:34 PM

Re: printing textarea & removing \n
 
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.


Daniel =?iso-8859-1?Q?Sj=F6blom?= 06-27-2003 05:42 PM

Re: printing textarea & removing \n
 
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.


Kyle Walz 06-27-2003 10:22 PM

Re: printing textarea & removing \n
 
Thanks for the tips. :)

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


All times are GMT. The time now is 03:35 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.