Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #469
| From | "noa" <noa@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Setting table row hei |
| Message-ID | <1166716693.753529.61440@42g2000cwt.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <PRxih.64$pc5.11435@wagner.videotron.net> |
| Date | 2011-04-27 15:27 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui On Dec 21, 5:36 pm, "Oliver Wong" <o...@castortech.com> wrote: > "noa" <noah.dr...@gmail.com> wrote in messagenews:1166689234.871145.216520@79g2000cws.googlegroups.com... > > > > > On Dec 20, 10:18 pm, "Oliver Wong" <o...@castortech.com> wrote: > >> "noa" <noah.dr...@gmail.com> wrote in > >> messagenews:1166621857.102513.143040@48g2000cwx.googlegroups.com... > > >> > 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* > > 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 > cell with the "blah blah blah", so it doesn't actually work. > > 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? --- * 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 | Next — Previous in thread | Next in thread | Find similar
Setting table row height "noah.drach" <noah.drach@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "noa" <noa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "noa" <noa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "noa" <noa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "noa" <noa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "noa" <noa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "noa" <noa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "noa" <noa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
Re: Setting table row hei "noa" <noa@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
csiph-web