Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #317
| From | "Bart Cremers" <bart.cremers@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: setCellRenderer for s |
| Message-ID | <1165218307.459551.49220@73g2000cwn.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <1165203956.958986.34320@79g2000cws.googlegroups.com> |
| Date | 2011-04-27 15:26 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui Nickolay Cherkezishvili wrote: > Bart Cremers wrote: > > terpatwork@hotmail.com wrote: > > > Hi, > > > I'm working on JTable ->HTML Table representations and I'm trying to > > > figure out how to set a CellRenderer for a specific cell, rather than > ............................ > > } > > /* End sample code */ > > } > > > > > > Regards, > > > > Bart > > That's very nice solution, but there is too many code in one class :) > what about another solution: > > Making many single renderers for each cell type, then overriding > JTable.getCellRenderer(int,int) - overriden function should return > specific renderer ;) > > I use this method because it's much cleaner I can't see where there are to many lines in one class. Dropping the sample code from the renderer you're left with 25 lines of code, which is a rather small class in my opinion. There are two reason why I wouldn't go for overriding getCellRenderer in this case. First, the cellrenderer returned should be specified by the class of the value. It's much cleaner to go through a renderer subclass in this case. The second is, I simply don't like to subclass Swing components unless there is no other way. Regards, Bart --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar
setCellRenderer for speci "terpatwork" <terpatwork@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
Re: setCellRenderer for s "Bart Cremers" <bart.cremers@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
Re: setCellRenderer for s "terpatwork" <terpatwork@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
Re: setCellRenderer for s "Nickolay Cherkezishvili" <nickolay.cherkezishvili@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
Re: setCellRenderer for s "Bart Cremers" <bart.cremers@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
Re: setCellRenderer for s "Nickolay Cherkezishvili" <nickolay.cherkezishvili@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
Re: setCellRenderer for s "Nickolay Cherkezishvili" <nickolay.cherkezishvili@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
csiph-web