Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JList in a JTable  RSS feed

 
Jeremy Hooie
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a very complex table and I want to display certain columns and rows with variably sized data as scrollable lists. I have tried numerous configurations with no success. I have a custom Renderer which extends a JList and implements TableCellRenderer. Does anyone have a working example using a JList as a TableCellRenderer/Editor? Any help would be greatly appreciated.
Thanks in Advance,
Jeremy
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the examples at this site: Swing
 
Jeremy Hooie
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The getCellEditorValue() method in the CellEditor interface returns an Object. If I have a ListEditor/ListRenderer combination, should I return a reference to the List itself, or the model?
 
Jeremy Hooie
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've answered my own question. I returned the reference to the model in the getCellEditorValue method of the TableCellEditor, but had to make provisions to accept both Strings and DefaultListModels in the getTableCellRendererComponent method of the TableCellRenderer and distinguishing b/n the two using the instanceof operator.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!