• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextPane coloing singular words.

 
Jamie Vaugh
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd really love to be able to make it so I can change the color of words without changing the color of the whole line, for example I have a picture of what I'd really love to build



Thanks greatly, it would be a shine of light to get help to accomplish this.

Peace..
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the JTextPane API and follow the link to the Swing tutorial that will provide an example of using attributes to color text.

You can also search the web using "syntax highlighting".
 
Jamie Vaugh
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thank you.
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dnwload a library for this. I've tried writing something like this myself, and while most of it works, the code still can't handle Strings and comments.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!