Hi, I need to set the height of a JTextArea with fixed width to fit a text inside. How can I do it ? Actually what I�m trying do to is to make cells multiline in a JTable without specifing a fixed row height. It should be detected depending on columns widths and text length of each cell. Thanks Jean
You should be able to call setPreferredSize() in the getTableCellRendererComponent() method of your renderer... since you have a reference to the table, row, column and the value that is going to be displayed you should be able to calculate it. I think that if you call super.getPreferredSize() it will return the size needed for the text... not sure if it takes into account the set width, though...
Thanks! and welcome to the JavaRanch!
Write once, run anywhere, because there's nowhere to hide! - /. A.C.