Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change text color..

 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to change text color of a text component, not all the text, but some selected words only.
Eg:- This is the example text..

Is there a way to do this using any java JTextComponent...??
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to do this using any java JTextComponent,

yes by using Html, then not only for JTextComponents, for all JComponents


for JTextComponents there are two ways

1. multiple of Highlighters for JTextPane/JEditorPane

2. Html, notice current Java support Html <= Html3.2 and with reduced support for css
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I use html. Can you give me a link to refer..??
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to Use HTML in Swing Components and How to Use Editor Panes and Text Panes would be a good place to start. These both contain examples that you can use as a reference.
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your help..
I got the answer..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic