java - Highlight cell when row is selected -
the problem having when select row, cell custom cell renderer doesn't highlight cell other cells.
public component gettablecellrenderercomponent( jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) { setfont(applicationstyles.table_font); if (value != null) { bigdecimal decimalvalue = tobigdecimal(value); decimalvalue = decimalvalue.setscale(2, bigdecimal.round_half_even); decimalformat formatter = new decimalformat("$##,##0.00"); formatter.setminimumfractiondigits(2); formatter.setminimumfractiondigits(2); string formattedvalue = formatter.format(value); settext(formattedvalue); } return this; }
the easiest way format data override setvalue(...)
method of default renderer demonstrated in swing tutorial on using custom renderers. don't have worry highlighting.
or maybe easier use table format renderer need provide format
used renderer.
Comments
Post a Comment