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


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

Re: How to print a JTextA

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
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)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <1174439230.149042.105820@n76g2000hsh.googlegroups.com>
References <1174439230.149042.105820@n76g2000hsh.googlegroups.com>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 40
Date Wed, 27 Apr 2011 15:32:19 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918339 96.60.20.240 (Wed, 27 Apr 2011 10:32:19 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:32:19 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1268

Show key headers only | 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