Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Oliver Wong" Subject: Re: Setting table row hei Message-ID: X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: <1166689234.871145.216520@79g2000cws.googlegroups.com> References: <1166689234.871145.216520@79g2000cws.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: 43 Date: Wed, 27 Apr 2011 15:27:42 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303918062 96.60.20.240 (Wed, 27 Apr 2011 10:27:42 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:27:42 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:468 To: comp.lang.java.gui "noa" wrote in message news:1166689234.871145.216520@79g2000cws.googlegroups.com... > > > On Dec 20, 10:18 pm, "Oliver Wong" wrote: >> "noa" 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 --- * 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