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: "Daniel" Subject: jtable row height problem Message-ID: X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 54 Date: Wed, 27 Apr 2011 15:25:48 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303917948 96.60.20.240 (Wed, 27 Apr 2011 10:25:48 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:25:48 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:135 To: comp.lang.java.gui Hello all, I have a problem with a jtable. I have written a program to simplify the translation of the texts in my main application. So basically what happen is that my editor reads the .properties file and lets the user change the values of them. The problem comes when the user is trying to view a value with html text in it. What happened was that the html formatting contained linebreaks and the default table cell renderer did the linebreaks BUT the height of the cell did not update so all you could see was the bottom of the first line and the top of the second. I tried to fix this by using my own cell renderer that adjusted the height if the preferred height of the renderer was greater than the height of the row. This almost worked, the row now becomes heigh enough to hold the whole text BUT the cell is always rendered with an empty line at the top, which means the last line is not visible. Any suggestions on how to fix this? I will try to make a minimal code example during the weekend. I post the code for the cell renderer as it is short and possibly (even probably) the cause of the problem public class CellRenderer extends DefaultTableCellRenderer { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c= super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column); if(table.getRowHeight(row)