-2

I have textarea which show file data content. I have table view which contains line numbers and when double click on table view I can able to retrieve line number so I need to change the color of particular line number in textarea using JavaFx controller. How to do that? Please share your code. Thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
chethan
  • 25
  • 7

1 Answers1

0

Please provide some code. With the TextArea UI-Control you can only add color to the whole containing text. For your purpose you should use HTMLEditor to style your text content individually.

See also: Using JavaFX UI Controls - HTML Editor

Kami
  • 459
  • 1
  • 6
  • 27
  • Is there any other way other than HTML Editor because i dont need paragraph styling and cut and other options .Just i need show text data by highlighting the perticular line from controller. – chethan Jul 28 '15 at 07:57
  • No, according to [this](http://stackoverflow.com/questions/10075841/how-to-hide-the-controls-of-htmleditor), Java FX doesn't support such UI-Control apparently . But try one of [his](http://stackoverflow.com/a/23203211/3102124) answers . – Kami Jul 28 '15 at 08:21
  • i have got one link from stackoverflow regarding this https://github.com/TomasMikula/RichTextFX and stack question http://stackoverflow.com/questions/30114478/is-it-possible-to-set-different-colors-for-different-lines-in-a-javafx-textfield – chethan Jul 28 '15 at 08:32
  • @chethan When this solved your problem.. please mark this as an answer :) thanks. – Kami Jul 28 '15 at 12:53