spulciando il forum della sun è saltato fuori questo
codice:
class TableRenderer extends JTextArea implements TableCellRenderer{
public TableRenderer(){
setLineWrap(true);
setWrapStyleWord(true);
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean
hasFocus, int row, int column)
{
if (isSelected) {
setForeground(tblOt.getSelectionForeground());
setBackground(tblOt.getSelectionBackground());
} else {
setForeground(tblOt.getForeground());
}
setFont(tblOt.getFont());
if (hasFocus) {
setBorder( UIManager.getBorder("Table.focusCellHighlightBorder") );
if (tblOt.isCellEditable(row, column)) {
setForeground( UIManager.getColor("Table.focusCellForeground") );
setBackground( UIManager.getColor("Table.focusCellBackground") );
}
} else {
setBorder(new EmptyBorder(1, 2, 1, 2));
}
setText((value == null) ? "" : value.toString());
return this;
}
}
ossia il linewrap. qui il tipo usa una textarea, per cui il discorso è fattibile con un semplice setLineWrap... se usi labels o simili, ahi, penso che dovrai determinare la larghezza delle stringhe (dal font e numero di caratteri) e giocare un po' con quelle...