Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I draw icons in the JTextComponent?  RSS feed

 
simen wu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to add some icons in the JTextArea, but how can I do that? Can anyone show some light on that?
 
krishna anand
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To embedd Icons you have to use JTextPane's method insertIcon(Icon) and you cannot do this with JTextArea.
JTextArea,JTextFieldand JPasswordField are simple text components that can display only one font and one color at a time .To display different content's you will have to use JEditorPane ( displaying HTML ,RTF )and JTextPane ( displaying images & components )

------------------
Krishna
 
simen wu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, krishna.
Thanks for your reply. I'm trying JTextPane and it works. Thank you.
Simen
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!