Trying to color specific rows of JTable using Custom Renderer, instead all my rows are colored
<p>for my Java program basically when the value in column 4 of my JTable is greater than column 3, I want those specific rows to be colored in red and not the other rows. </p>

<p>I have implemented the following code, but for some reason all my rows are getting colored in red rather than just the ones matching the criteria. </p>

<pre><code>table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer(){
    @Override
    public Component getTableCellRendererComponent(JTable table, 
                   Object value, boolean isSelected, boolean hasFocus, int row, int col) {

        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);

        int Value1= Integer.parseInt(table.getModel().getValueAt(row, 3).toString());
        int Value2= Integer.parseInt(table.getModel().getValueAt(row, 4).toString());
        if (Value2&gt;=Value1) {                        
            setBackground(Color.red);
        } 
        return this;
    }   
});
</code></pre>

<p>Any suggestions/tips on how to fix this? </p>