java - Change JTable row foreground -
i trying color red, foreground when time around condition, painting foreground of rows(should seven).what doing wrong?code below:
class redrenderer extends defaulttablecellrenderer{ @override public component gettablecellrenderercomponent(jtable table, object value,boolean isselected, boolean hasfocus, int row, int column) { super.gettablecellrenderercomponent(table, value, isselected, hasfocus, row, column); bigdecimal time=new bigdecimal(jtable.getmodel().getvalueat(row, 17).tostring()); if(time.compareto(new bigdecimal(2))<=0){ setforeground(color.red); setbackground(color.white); }else{ setbackground(null); } return this; } }
have tried explicitly setting foreground color different if current row doesn't match criteria?
Comments
Post a Comment