• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Stripy Tables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Stripy Tables
      • From: Thomas Deniau <email@hidden>
  • Prev by Date: Pass command line arguments to the app?
  • Next by Date: Re: cocoa/Obj-C API for iCal
  • Previous by thread: Re: Pass command line arguments to the app?
  • Next by thread: Re: Stripy Tables
  • Index(es):
    • Date
    • Thread