Re: printing textarea & removing \n

Discussion in 'Java' started by Daniel =?iso-8859-1?Q?Sj=F6blom?=, Jun 27, 2003.

  1. 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?=, Jun 27, 2003
    #1
    1. Advertising

  2. 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.
    Daniel =?iso-8859-1?Q?Sj=F6blom?=, Jun 27, 2003
    #2
    1. Advertising

  3. Daniel =?iso-8859-1?Q?Sj=F6blom?=

    Kyle Walz Guest

    Thanks for the tips. :)

    I'll try my own replace method. Haven't checked if JBuilder 8 is free
    yet--no money to spend.
    Kyle Walz, Jun 27, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. diablo

    removing html from textarea

    diablo, Jun 28, 2005, in forum: HTML
    Replies:
    5
    Views:
    552
    Adrienne
    Jul 1, 2005
  2. Chris  Chiasson
    Replies:
    6
    Views:
    602
    Richard Tobin
    Nov 14, 2006
  3. Augustus
    Replies:
    1
    Views:
    333
    Ken Schaefer
    Sep 10, 2003
  4. Textarea Inside of a textarea

    , Feb 4, 2006, in forum: ASP General
    Replies:
    6
    Views:
    311
    Anthony Jones
    Feb 5, 2006
  5. Replies:
    1
    Views:
    293
    Bart Van der Donck
    Jul 4, 2007
Loading...

Share This Page