package example;
//-*- mode:java; encoding:utf8n; coding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;

public class MainPanel extends JPanel{
    public MainPanel() {
        super(new BorderLayout());
        add(new JScrollPane(makeTable()));
        setPreferredSize(new Dimension(320, 240));
    }
    String[] columnNames = {"aaa", "bbb"};
    Object[][] data = {
        {Integer.MIN_VALUE, Integer.MIN_VALUE},
        {1, 1}, {1, 2}, {1, -1}, {1, 3}, {1, 0},
        {1, 5}, {1, 4}, {1, -5}, {1, 0}, {1, 6},
        {Integer.MAX_VALUE, Integer.MAX_VALUE}
    };
    DefaultTableModel model = new DefaultTableModel(data, columnNames) {
        @Override public Class<?> getColumnClass(int column) {
            return Integer.class; //getValueAt(0, column).getClass();
        }
        @Override public boolean isCellEditable(int row, int column) {
            return row>0 && row!=model.getRowCount()-1;
        }
    };
    public JTable makeTable() {
        final JTable table = new JTable(model);
        final RowFilter<TableModel,Integer> filter = new RowFilter<TableModel,Integer>() {
            @Override public boolean include(Entry<? extends TableModel, ? extends Integer> entry) {
                return 0 != table.convertRowIndexToView(entry.getIdentifier());
            }
        };
        final TableRowSorter<TableModel> s = new TableRowSorter<TableModel>(model) {
            @Override public void toggleSortOrder(int column) {
                RowFilter<? super TableModel, ? super Integer> f = getRowFilter();
                setRowFilter(null);
                super.toggleSortOrder(column);
                setRowFilter(f);
            }
        };
        s.setRowFilter(filter);
        //s.setSortsOnUpdates(true);
        s.toggleSortOrder(1);
        table.setRowSorter(s);

        TableColumnModel col = table.getColumnModel();
        for(int i=0;i<col.getColumnCount();i++) {
            final TableCellRenderer r = table.getDefaultRenderer(model.getColumnClass(i));
            col.getColumn(i).setCellRenderer(new TableCellRenderer() {
                @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                    JLabel l;
                    if(row==model.getRowCount()-2) {
                        int i = getSum(table.convertColumnIndexToModel(column));
                        l = (JLabel)r.getTableCellRendererComponent(table, i, isSelected, hasFocus, row, column);
                        l.setBackground(Color.ORANGE);
                    }else{
                        l = (JLabel)r.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                        l.setBackground(Color.WHITE);
                    }
                    l.setForeground(Color.BLACK);
                    return l;
                }
            });
        }
        return table;
    }
    private int getSum(int column) {
        int counter = 0;
        for(int i=1;i<model.getRowCount()-1;i++) {
            counter += (Integer)model.getValueAt(i,column);
        }
        return counter;
    }
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            @Override public void run() {
                createAndShowGUI();
            }
        });
    }
    public static void createAndShowGUI() {
        try{
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }catch(Exception e) {
            e.printStackTrace();
        }
        JFrame frame = new JFrame("@title@");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.getContentPane().add(new MainPanel());
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

@@ -1946,245 +1946,318 @@
     
-TableColumnModel col = table.getColumnModel();%0A        for(int i=0;i%3Ccol.getColumnCount();i++) %7B%0A            final TableCellRenderer r = table.getDefaultRenderer(model.getColumnClass(i));%0A            col.getColumn(i).setCellRenderer(new 
+model.addTableModelListener(new TableModelListener() %7B%0A            @Override public void tableChanged(TableModelEvent e) %7B%0A                if(e.getType()==TableModelEvent.UPDATE) %7B%0A                    table.repaint();%0A                %7D%0A            %7D%0A        %7D);%0A        TableCellRenderer renderer = new Default
 Tabl
@@ -2270,28 +2270,24 @@
 enderer() %7B%0A
-    
             
@@ -2448,20 +2448,16 @@
         
-    
 JLabel l
@@ -2454,28 +2454,24 @@
   JLabel l;%0A
-    
             
@@ -2523,28 +2523,24 @@
             
-    
 int i = getS
@@ -2596,36 +2596,32 @@
                 
-    
 l = (JLabel)r.ge
@@ -2608,32 +2608,36 @@
     l = (JLabel)
+supe
 r.getTableCellRe
@@ -2710,36 +2710,32 @@
                 
-    
 l.setBackground(
@@ -2769,23 +2769,15 @@
     
- 
-   
 %7Delse%7B%0A
-    
     
@@ -2804,16 +2804,20 @@
 (JLabel)
+supe
 r.getTab
@@ -2902,36 +2902,32 @@
                 
-    
 l.setBackground(
@@ -2952,34 +2952,26 @@
             
- 
-   %7D%0A    
+%7D%0A
             
@@ -3016,28 +3016,24 @@
             
-    
 return l;%0A  
@@ -3033,38 +3033,45 @@
 n l;%0A           
+ %7D%0A
      
-%7D
+   %7D;
 %0A            %7D);
@@ -3059,29 +3059,171 @@
  %7D;%0A        
-    %7D
+TableColumnModel cm = table.getColumnModel();%0A        for(int i=0;i%3Ccm.getColumnCount();i++) %7B%0A            cm.getColumn(i).setCellRenderer(renderer
 );%0A        %7D

add TableModelListener