Stripy Tables
Stripy Tables
- Subject: Stripy Tables
- From: Graham Savage <email@hidden>
- Date: Thu, 17 Jul 2003 13:22:33 -0700
Hi,
I have a Cocoa-Java app and I want to stripe the rows like Apple does
everywhere.
I know there are more complex ways to do this, but I figured the
following simple code in my NSTableView's delegate would work fine:
public void tableViewWillDisplayCell( NSTableView tv, Object cell,
NSTableColumn col, int row) {
NSTextFieldCell tfc = (NSTextFieldCell)cell;
if (row%2==0) {
tfc.setBackgroundColor(NSColor.colorWithDeviceRGB(0.929f,
0.953f, 0.996f, 1.0f));
} else {
tfc.setBackgroundColor(NSColor.whiteColor());
}
}
Problem is, it only stripes one column (always the middle of three),
even though it is getting called for all cells in all columns.
Any Ideas before I resort to more complex means?
Kind Regards,
Graham
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.