Link to home
Start Free TrialLog in
Avatar of Triguna
TrigunaFlag for India

asked on

URGENT!!!! How to add an image and a TextField Together into a JTable

Hi Experts,


    I am struggling to find this,

   How to add an image and a text into the same cell of a JTable?

   This is something like this when seen in a JTable

    [<image goes here>]  Text                       [image 1 goes here] Text 1
 
    [<image 2 goes here>] Text 2                   [image 3 goes here] Text 3

    [<image 4 goes here>] Text 4                   [image 5 goes here] Text 5


  Please solve this problem as soon as possible....

Thank you in advance,

regards
Triguna M S
Avatar of sciuriware
sciuriware

Set the image(s) to be background.
;JOOP!
Avatar of TimYates
Define your own CellRenderer which uses a JLabel (you can setIcon() on a JLabel, and it will appear on the left of the text)

http://www.javaalmanac.com/egs/javax.swing.table/CustRend.html
Avatar of Triguna

ASKER

Thank you for your comments.

TimYates,

    I will try that and get back to you.

Good luck!

Let us know if you have problems!!

Tim
Avatar of Triguna

ASKER

TimYates,

  I tried to add the ICONS but no result.

  Can u please explain me with a small code?

 thank you.

regads
Triguna M S
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Triguna

ASKER

Thank you for the comment...

Tim Yates.

I will try that and will get back to you soon,

Sorry for the late reply.
Avatar of Triguna

ASKER

Thank you very much. It worked for me.

Thanks a lot.
Yay!  Cool :-)

Good luck with it all :-)

Tim