aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Any concerns with using the same cell renderer object for a number of cells? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Any concerns with using the same cell renderer object for a number of cells?" Watch "Any concerns with using the same cell renderer object for a number of cells?" New topic
Author

Any concerns with using the same cell renderer object for a number of cells?

Tom Landry
Ranch Hand

Joined: May 26, 2013
Posts: 76
I have a number of cells which are Dates and need to have them appear in the same format.
The samples I have seen usually create a new cell renderer object for each cell, even if its the same type.
Since I have a number of Date cells I thought it best to use a single object for each of the date cells, but after seeing the different samples I am wondering if there is something I may be missing where using the same cell renderer object could potentially be an issue.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41863
    
  63
I think that's fine. I guess I looked at different sample code -it never occurred to me one might use a separate renderer object for the same kind of cell :-)


Ping & DNS - my free Android networking tools app
Brett Spell
Ranch Hand

Joined: Feb 24, 2001
Posts: 96
Tom Landry wrote:The samples I have seen usually create a new cell renderer object for each cell, even if its the same type.


Then I'd look for a different source of sample code; creating a new renderer for each cell is inefficient and completely unnecessary.

Tom Landry wrote:I thought it best to use a single object for each of the date cells, but after seeing the different samples I am wondering if there is something I may be missing where using the same cell renderer object could potentially be an issue.


No, you're absolutely correct. Renderers are meant to be used to draw multiple cells of the same type.
Tom Landry
Ranch Hand

Joined: May 26, 2013
Posts: 76
Great, thanks for the confirmation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Any concerns with using the same cell renderer object for a number of cells?