Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can i show ImageIcon within JTextArea ?  RSS feed

 
sarim raza
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTextArea that displays textual results
sometimes i want to display an image (jpg etc)
in that place. Can i attach the image to the
JTextArea or do i need to get rid of it first and
just attach it to the JPanel ?
thanks
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you can display an image inside a text area. either you use jtextpane, or jeditorpane, or you do as you suggested: get rid of the text area and use - not a jpanel, but a jlabel (and set the image as its (Image)Icon). if the jpgs are of limited number you could use a card layout. it is fast and you won't have to bother with any repainting logic which sometimes can be quite annoying.
cheers
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!