• Post Reply Bookmark Topic Watch Topic
  • New Topic

Change color in a range of text on a TextField

 
El�as Orozco
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, is there a way of changing the color of a single letter or a range of text in a TextField? I want to put some info on a TextField, but want certain words to be in another color. Thanks,

El�as
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot give you an exact program,but a way is as
you can use the swing component JColorChooser.
 
Campbell Ritchie
Marshal
Posts: 52531
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch , Elias.

Information is probably best put in a JLabel rather than a JTextField.
JLabels will accept text formatted with <html></html> tags, so try setting font colour with html. Tell us whether it works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!