aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes can i show ImageIcon within JTextArea ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "can i show ImageIcon within JTextArea ?" Watch "can i show ImageIcon within JTextArea ?" New topic
Author

can i show ImageIcon within JTextArea ?

sarim raza
Ranch Hand

Joined: Nov 02, 2000
Posts: 232
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

Joined: Sep 28, 2000
Posts: 508
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.
 
subject: can i show ImageIcon within JTextArea ?