• Post Reply Bookmark Topic Watch Topic
  • New Topic

change a color of a particular line in jtextarea

 
vibhas bhingarde
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using jtextarea containing nearly 1000 lines but i want only a particular line
that appears after some interval(not constant interval)
so i want to change the color of text only of that particular line.
that line which is being repeated is stored in a string


sample code :

String end="----------------------////-------------------------------Question " +String.valueOf(o)+ " Ends-----------------------------////-----------------------------------";
questionlistarea.append(end); //want to change color of this string only

i want to change color only of text stored in a string "end".
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use javax.swing.text.Highlighter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!