84255

Multiple colors in JavaFX Textarea

Question:

How would I change the color of different text in a textarea in JavaFX? I've been doing some research, and I can only find solutions for Java Swing, not JavaFX.

To describe my situation, I'm trying to highlight different keywords in code, like a IDE. Basically, like this:

<img alt="Color coded text" class="b-lazy" data-src="https://i.stack.imgur.com/Nc5QB.png" data-original="https://i.stack.imgur.com/Nc5QB.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

In the above image, certain words are different colors.(.list is red, span is blue, etc.)

Does anyone know how to apply this effect to a JavaFX Textarea?

Answer1:

<a href="https://github.com/TomasMikula/RichTextFX" rel="nofollow">RichTextFX</a> lets you to assign different styles to different ranges of text. You will have to parse the CSS yourself, though. See the <a href="https://github.com/TomasMikula/RichTextFX#automatic-highlighting-of-java-keywords" rel="nofollow">demo of highlighting Java keywords</a>

Recommend

  • CVS command to get the current revision number of file
  • How to validate a url with lots of querystrings
  • Wait for Swing to finish updating JProgressBar before continuing
  • Does Swing come with Calendar and time field components?
  • Android Ripple: How do other apps make their ripple so transparent without affecting the original co
  • Run/Debug Maven JavaFX 2 in Netbeans
  • Where and How To Define An Application Property? - JHIpster
  • How to attach php documentation in eclipse
  • Threads in jMonkey and Nifty?
  • Mongoose TypeError: Cannot use 'in' operator to search for '_id' in
  • Ruby and class variables in inherit class
  • Insertion large number of Entities into SQL Server 2012 [duplicate]
  • How to create two column output from a single column
  • Google Maps api v3 get start and end coordinates of a street
  • Most efficient way to move table rows from one table to another
  • How do I mock an exported typescript function in a jasmine test?
  • Image map in Flex
  • Git describe fails to return most recent annotated tag
  • Debugging VB6 Code From Visual Studio 2010
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • Swing - Get new component under mouseReleased
  • MVC3 Razor - ListBox pre-select not working
  • Python urlparse: small issue
  • How to delay loading a property with linq to sql external mapping?
  • FileReader+canvas image loading problem
  • Insert into database using onclick function
  • JavaScriptCore crash on iOS9
  • angularjs unit test when to use $rootScope.$new()
  • Validaiting emails with Net.Mail MailAddress
  • MySQL WHERE-condition in procedure ignored
  • How to model a transition system with SPIN
  • Web-crawler for facebook in python
  • SVN: Merging two branches together
  • Transpose CSV data with awk (pivot transformation)
  • trying to dynamically update Highchart column chart but series undefined
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • java string with new operator and a literal