@ Override public Component getTableCellRendererComponent ( JTable table , Object value , boolean isSelected , boolean hasFocus , int rowIndex , int vColIndex ) { // 'value' is value contained in the cell located at // (rowIndex, vColIndex) if ( isSelected ) { // cell (and perhaps other cells) are selected } if ( hasFocus ) { // this cell is the anchor and the table has the focus } JComponent result = label ; // Configure the component with the specified value if ( ! value . toString ( ) . equals ( "" ) ) { result = button ; ( ( JButton ) button ) . setText ( value . toString ( ) ) ; } // Set tool tip if desired //setToolTipText((String)value); // Since the renderer is a component, return itself return result ; }
using this renderer needs to be rendered .