This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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