Re: How to print a JTextArea?



layne79 wrote:
Hello,
I'm trying to implement a printing mechanism for JTextArea but I have
a problem on extracting lines from it.
I used the xample found at http://java.sun.com/docs/books/tutorial/2d/printing/set.html
(PaginationExample class) but, instead of having available an array of
String (textlines), I have a JTextArea.
I need to replace the instruction

g.drawString(textLines[line], 0, y);

at line 93

with another, taking lines from the textarea.

Dou you know how I can do that?

Layne,

Ever since JDK1.6 the JTextArea has a method called getPrintable that
it gets from JTextComponent. You could start there instead of writing
your own printable.

Cheers,
Dan Andrews
---------------------------
http://www.ansir.ca

.



Relevant Pages

  • How to print a JTextArea?
    ... a problem on extracting lines from it. ... I used the xample found at http://java.sun.com/docs/books/tutorial/2d/printing/set.html ... (PaginationExample class) ... String, I have a JTextArea. ...
    (comp.lang.java.gui)
  • Re: How to print a JTextArea?
    ... Dan Andrews wrote: ... a problem on extracting lines from it. ... I used the xample found at http://java.sun.com/docs/books/tutorial/2d/printing/set.html ... String, I have a JTextArea. ...
    (comp.lang.java.gui)
  • Re: How to print a JTextArea?
    ... I'm trying to implement a printing mechanism for JTextArea but I have ... a problem on extracting lines from it. ... I used the xample found at http://java.sun.com/docs/books/tutorial/2d/printing/set.html ... String, I have a JTextArea. ...
    (comp.lang.java.gui)