Re: Setting table row height according the renderer component
- From: "noa" <noah.drach@xxxxxxxxx>
- Date: 21 Dec 2006 07:58:13 -0800
On Dec 21, 5:36 pm, "Oliver Wong" <o...@xxxxxxxxxxxxxx> wrote:
"noa" <noah.dr...@xxxxxxxxx> wrote in messagenews:1166689234.871145.216520@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Dec 20, 10:18 pm, "Oliver Wong" <o...@xxxxxxxxxxxxxx> wrote:
"noa" <noah.dr...@xxxxxxxxx> wrote in
messagenews:1166621857.102513.143040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Here, notice that the end of a string is marked "end of text"[code
snipped]
Works for me. I'm using Java 1.6.0.
1.I have to use 1.4*cell with the "blah blah blah", so it doesn't actually work.
2. are you sure it works? you saw the "end of text" string at the end
of every text cell? No, I only saw "end of text" for the cell with the snowboards, not the
The problem is that you're using getPreferredSize() to try to determine
the height of the cells. In the case of
"Snowboard\nSnowboard\nSnowboard\nend of text" (or whatever), your text is 4
lines long, and so the preferred size has a height such that it's possible
to display 4 lines. But your "Bla bla bla bla bla bla" is just 1 super long
line, and so the preferred size is something like "width = 500px, height =
20px", i.e. a super wide, but short, rectangle.
Since in your code, you only keep the maximum height, the height for the
Snowboard text is kept, and thus the height is only big enough for 4 lines,
not for the 10 lines of your bla bla bla text.
It looks like you might have to perform line wrapping calculations
manually to get the effect you want.
- Oliver
I thought that a JTextPane wraps automatically, so if i limit it's
width the height is calculated automatically.
I was wrong?
.
- Follow-Ups:
- Re: Setting table row height according the renderer component
- From: Oliver Wong
- Re: Setting table row height according the renderer component
- References:
- Setting table row height according the renderer component
- From: noah . drach
- Re: Setting table row height according the renderer component
- From: Andrew Thompson
- Re: Setting table row height according the renderer component
- From: Oliver Wong
- Re: Setting table row height according the renderer component
- From: noa
- Re: Setting table row height according the renderer component
- From: Oliver Wong
- Setting table row height according the renderer component
- Prev by Date: Re: Setting table row height according the renderer component
- Next by Date: Re: Setting table row height according the renderer component
- Previous by thread: Re: Setting table row height according the renderer component
- Next by thread: Re: Setting table row height according the renderer component
- Index(es):