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


Groups > comp.lang.java.gui > #3429 > unrolled thread

printing a JLabel text ab

Started by"magowiz" <magowiz@THRWHITE.remove-dii-this>
First post2011-04-27 15:44 +0000
Last post2011-04-27 15:44 +0000
Articles 5 — 2 participants

Back to article view | Back to comp.lang.java.gui


Contents

  printing a JLabel text ab "magowiz" <magowiz@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
    Re: printing a JLabel tex "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
      Re: printing a JLabel tex "magowiz" <magowiz@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
    Re: printing a JLabel tex "magowiz" <magowiz@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
      Re: printing a JLabel tex "magowiz" <magowiz@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000

#3429 — printing a JLabel text ab

From"magowiz" <magowiz@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
Subjectprinting a JLabel text ab
Message-ID<5FnQj.22926$o06.3990@tornado.fastwebnet.it>
  To: comp.lang.java.gui
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

---
 * 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

[toc] | [next] | [standalone]


#3432 — Re: printing a JLabel tex

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
SubjectRe: printing a JLabel tex
Message-ID<46hb1493tkvt0ctm7eskdbl30um8j7dl9o@4ax.com>
In reply to#3429
  To: comp.lang.java.gui
On Fri, 25 Apr 2008 18:28:47 +0200, magowiz
<magowizNOSPAM@fastwebnet.it> wrote, quoted or indirectly quoted
someone who said :

>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.

Either use two JLabels or use <br> to split the line
-- 

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * 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

[toc] | [prev] | [next] | [standalone]


#3436 — Re: printing a JLabel tex

From"magowiz" <magowiz@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
SubjectRe: printing a JLabel tex
Message-ID<t9FRj.26196$o06.25147@tornado.fastwebnet.it>
In reply to#3432
  To: comp.lang.java.gui
Roedy Green ha scritto:
> Either use two JLabels or use <br> to split the line

I think I didn't explain myself well, in any case the font size of 
MessageFormat header in the jtable.print() method is too big, if I want 
to print out that string with that fontsize I must split that string 
into 6 or 7 lines . Anyway are you sure that on MessageFormat(s) html 
tags are accepted ?

---
 * 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

[toc] | [prev] | [next] | [standalone]


#3437 — Re: printing a JLabel tex

From"magowiz" <magowiz@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
SubjectRe: printing a JLabel tex
Message-ID<9uFRj.26234$o06.8223@tornado.fastwebnet.it>
In reply to#3429
  To: comp.lang.java.gui
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.

---
 * 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

[toc] | [prev] | [next] | [standalone]


#3438 — Re: printing a JLabel tex

From"magowiz" <magowiz@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
SubjectRe: printing a JLabel tex
Message-ID<dcGRj.26293$o06.5586@tornado.fastwebnet.it>
In reply to#3437
  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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web