1 18 19 package org.apache.jmeter.gui.util; 20 21 import java.awt.Component ; 22 23 import javax.swing.JTable ; 24 import javax.swing.JTextArea ; 25 import javax.swing.table.TableCellRenderer ; 26 27 31 public class TextAreaCellRenderer implements TableCellRenderer 32 { 33 34 private JTextArea rend = new JTextArea (""); 35 36 public Component getTableCellRendererComponent( 37 JTable arg0, 38 Object arg1, 39 boolean arg2, 40 boolean arg3, 41 int arg4, 42 int arg5) 43 { 44 rend = new JTextArea (arg1.toString()); 45 rend.revalidate(); 46 if (!arg3 && !arg2) 47 { 48 rend.setBackground(JMeterColor.LAVENDER); 49 } 50 if (arg0.getRowHeight(arg4) < getPreferredHeight()) 51 { 52 arg0.setRowHeight(arg4, getPreferredHeight()); 53 } 54 return rend; 55 } 56 57 public int getPreferredHeight() 58 { 59 return rend.getPreferredSize().height + 5; 60 } 61 } 62 | Popular Tags |