The isPaintingForPrint method defined in the JComponent class allows us to customize what we print compared with that can be seen on the screen. Just have a look on following example which explains the same :
Code:
protected static class BWPassedColumnDemo extends PassedColumnDemo {
public Component getTableCellDemoComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
super.getTableCellDemoComponent(table, value, isSelected,
hasFocus, row, column);
if (table.isPaintingForPrint()) {
boolean status = (Boolean)value;
setIcon(status ? passedIconBW : failedIconBW);
}
return this;
}
}
Bookmarks