Results 1 to 5 of 5
  1. #1
    L19htn1n9 is offline Member
    Join Date
    Jul 2011
    Posts
    32
    Rep Power
    0

    Question How to print a multi page long JTextArea

    is there a way to get the contents of a JTextArea, that holds many lines of text, to print to multiple pages, I tried the normal way with the g.drawString(jtextarea.getText());
    but after 26 lines my page is full so it stops there.

    Is there a way to make the entire content print?

    a code snippet would be nice

    greetings, L19ht1n9

  2. #2
    L19htn1n9 is offline Member
    Join Date
    Jul 2011
    Posts
    32
    Rep Power
    0

    Default

    well actually i got a for loop that would walk through the jtextarea and then for each line add a new g.drawstring(); with what was on that line

  3. #3
    L19htn1n9 is offline Member
    Join Date
    Jul 2011
    Posts
    32
    Rep Power
    0

    Default

    but i tried some new codes, and forgot to backup my old code, that is now gone =( i hope you guys can point me in the right direction :D

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,317
    Rep Power
    25

    Default

    a way to make the entire content print?
    Where are you "printing" the text?
    The drawString method will draw it on a GUI component.

    Can you explain what you want to do? How many lines are in the textarea and how many lines do you want displayed? Where do you want them displayed? If there are too many to draw on a GUI, what then? A "Next Page" button to clear the GUI and draw the next n lines?

  5. #5
    L19htn1n9 is offline Member
    Join Date
    Jul 2011
    Posts
    32
    Rep Power
    0

    Default

    never mind, i already fixed it =) I just used the jtextarea.print(); command, that print the entire content of the JTextArea, even if it is on multiple pages

Similar Threads

  1. Trying to print from a JTextArea
    By Drun in forum AWT / Swing
    Replies: 1
    Last Post: 09-09-2010, 10:26 AM
  2. Long wait time before print job reaches printer
    By Astghik in forum AWT / Swing
    Replies: 0
    Last Post: 01-12-2010, 10:29 AM
  3. Print multi-colored characters in a sentence
    By Jeff Smith in forum New To Java
    Replies: 1
    Last Post: 07-24-2009, 03:43 AM
  4. Replies: 5
    Last Post: 05-25-2009, 09:03 PM
  5. system-print(ln) on jtextarea or jpanel
    By Tamu in forum Advanced Java
    Replies: 1
    Last Post: 11-25-2008, 05:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •