Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can i show ImageIcon within JTextArea ?

 
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic