java - TableCellRenderer selected cell problem -
i want implement tablecellrenderer of jtable component, should show different color depending on cell data. got this, can't change color of selected cell. tried this:
public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int rowindex, int vcolindex) { if (isselected) { this.setbackground((color)uimanager.get("table.selectionbackground")); this.setborder(javax.swing.borderfactory.createlineborder(new java.awt.color(0, 0, 0))); } else { this.setforeground((color)uimanager.get("table.foreground")); this.setbackground((color)uimanager.get("table.background")); this.setborder(borderfactory.createemptyborder()); } ... }
but not work :s .. can not see problem because jtable not show different when click on cell.
i want implement tablecellrenderer of jtable component, should show different color depending on cell data
the code posted not this. code duplicate default behaviour of renderer
you may find table row rendering approach easier implement.
Comments
Post a Comment