I have a column in my table showing timezones.
I wrote my own a tablecellrenderer TimeZoneRenderer to nicely display e.g. "GMT" instead of the default toString() output
"sun.util.Calendar.ZoneInfo [id="GMT", offset=0, dstSavings=0, .....]"
Now when I print my table using JFreeReport (fed with the table's model)
I don't get "GMT" but the default toString() output.
In general, is there some way to ask JFreeReport to use a specific renderer?
Thanks for any help.
withCode:table.setDefaultRenderer(TimeZone.class, new TimeZoneRenderer());
Code:public class TimeZoneRenderer extends DefaultTableCellRenderer { /** Creates a new instance of TimeZoneRenderer */ public TimeZoneRenderer() { } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value == null) return super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column); String displayString = ((TimeZone) value).getID(); return super.getTableCellRendererComponent( table, displayString, isSelected, hasFocus, row, column); } }


Reply With Quote
ops:
(yes, you have to set a name to be able to use it afterwards)


