Because everyone - even the early Swing team - has the right to do things the wrong way :-)
It is wrong to expand the component instead of implementing the visualizer interface and allow this implementation to delegate the component (which may be a specially implemented JLabel with all the whistles that they consider necessary, Iām not personally convinced). We are still suffering from this poor implementation decision - ominous "color memory "DefaultTableCellRenderer is a direct result.
So: Do-not-subclass-someComponent-to-implement-someRenderer. Especially not for someComponent == DefaultTableCellRenderer, it is broken!
BTW, SwingX does it right :-)
kleopatra
source share