Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1268

Re: How to print a JTextA

From "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this>
Subject Re: How to print a JTextA
Message-ID <4601eff7$0$24754$4c368faf@roadrunner.com> (permalink)
Newsgroups comp.lang.java.gui
References <1174439230.149042.105820@n76g2000hsh.googlegroups.com>
Date 2011-04-27 15:32 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Dan Andrews wrote:
> 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

Ever since? You say that like 1.6 has been out for ages when in fact 
it's the latest version available and only came out within the last few 
months.

> it gets from JTextComponent. You could start there instead of writing
> your own printable.
> 
> Cheers,
> Dan Andrews
> ---------------------------
> http://www.ansir.ca
>

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How to print a JTextArea? "layne79" <layne79@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
  Re: How to print a JTextA "Dan Andrews" <dan.andrews@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
    Re: How to print a JTextA "layne79" <layne79@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
      Re: How to print a JTextA "Dan Andrews" <dan.andrews@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
    Re: How to print a JTextA "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000

csiph-web