Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Multiple Objects in one JTable cell

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. Is it possible to add more than one ImageIcon object to one cell?
This is my code. It works fine.



What should I do to add more than one image to 1 cell?
 
Marshal
Posts: 72487
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our GUIs forum.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andraz Poje wrote:Hi. Is it possible to add more than one ImageIcon object to one cell?


What should I do to add more than one image to 1 cell?



http://tips4java.wordpress.com/2009/03/22/dual-icon/
http://tips4java.wordpress.com/2009/03/29/compound-icon/

Note that these Icon implementations don't play well with an ImageIcon that holds an animated GIF.
 
Sheriff
Posts: 22126
114
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can store multiple objects in a table cell indirectly - through an array or collection. That won't render the way you want though.

For showing two ImageIcons you can use a workaround though - use a custom Icon implementation, and make getColumnClass return Icon.class instead of ImageIcon.class. This custom implementation is not hard (pseudo code):
 
Andraz Poje
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compound Icon works great. Thanks.
 
It's just a flesh wound! Or a tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic