Dennis Putnam wrote:The demo does work for me too but I am obviously not understanding something fundamental.
luck, db
There are no new questions, but there may be new answers.
Dennis Putnam wrote:That is a poor tutorial for a beginner.
Dennis Putnam wrote:... perhaps because I am using my own TableModel or TableCellRenderer there is a required override of which I am unaware that bypasses the row selection handler when not present.
Dennis Putnam wrote:I hope I don't have to handle this in a renderer too because it can easily get complicated.
Paul Clapham wrote:Well, from your original post where you apparently couldn't tell how to use a JPanel, I would never have guessed that you had written your own cell renderer.
But you have misunderstood a fundamental design feature of Swing: the data (model) is always separated from the display (view). So when you select a row, that information (that the row is selected) is stored in the model. Specifically, in a class named something like SelectionModel.
But if you want to display selected rows differently, you're talking about the view, not the model. So it's the responsibility of something in the view to do that, not something in the model. Hence the TableCellRenderer.
Dennis Putnam wrote:Thanks for all the help. I found the problem, mostly by mistake. It seems my build path had the JRE library set to version 1.6. When I changed it to 1.7, everything began working.
Regards,
Mahesh Kedari - Fidus Technologies Ltd.
Consider Paul's rocket mass heater. |