Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "magowiz" Subject: Re: printing a JLabel tex Message-ID: X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: <9uFRj.26234$o06.8223@tornado.fastwebnet.it> References: <9uFRj.26234$o06.8223@tornado.fastwebnet.it> Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 47 Date: Wed, 27 Apr 2011 15:44:52 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303919092 96.60.20.240 (Wed, 27 Apr 2011 10:44:52 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:44:52 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:3438 To: comp.lang.java.gui magowiz ha scritto: > magowiz ha scritto: >> Hi, >> I'm trying to understand how to print a JLabel text above a JTable. >> Since the JLabel text is quite long ( 1 or 2 rows) the JTable print >> method with the two MessageFormat gives me the header in a too big >> character size and so the text gets truncated. >> I tried also with fjreport library but in this case I got the column >> size reduced and I got the data on it truncated. >> I would like to know how I can work it out. >> Thanking in advance >> Greetings >> >> magowiz > > I solved modifying the print method in this example > http://java.sun.com/developer/onlineTraining/Programming/JDCBook/Code/Report.java > > > as it follows : > > //drawing the two (in my case ) strings : > g2.drawString(DescRisJLabel.getText(),(int)0,(int)(0+fontHeight-fontDesent)); > > > g2.drawString(DescRis2JLabel.getText(),(int)0,(int)(0+(fontHeight*2)-fontDesent)); > > > //translating > g2.translate(0f,headerHeightOnPage+(fontHeight*2)); > g2.translate(0f,-pageIndex*pageHeightForTable); > [...] > > //setting clip > g2.setClip(0, (int)((pageHeightForTable+(fontHeight*2)) * pageIndex), > (int) Math.ceil(tableWidthOnPage), > (int) Math.ceil(oneRowHeight * numRowsLeft)); > > with this mods it prints out the two JLabels on top of the jtable. my mods works well only for the first page :( --- * 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