(Our source has migrated to GitHub!)
Preview Image
RSyntaxTextArea in action

Some of RSyntaxTextArea's features include:
  • Syntax highlighting for over 30 programming languages
  • Code folding
  • Code completion (Addon library, work in progress)
  • Find/Replace with standard options (regex, match case, etc.)
  • Loading and saving of local or remote files (via FTP)
  • User-defined macros
  • Code templates
  • Unlimited undo/redo
  • Drag and drop
  • Edit with multiple fonts simultaneously
  • Bracket matching
  • Current line highlighting
  • Clickable hyperlinks (only certain languages)
Quick Links
  • Try the applet demo.
  • Download the latest stable release at its SourceForge page.
  • Browse the Javadoc.
  • View the source code online.
  • Clone the repository on GitHub.
  • Peruse the examples and tutorials page. Eclipse project source code is included for the examples. Please be aware that this is a work in progress, and we're adding to it whenever we can!
  • Developer's documentation covering how to add syntax highlighting and code folding for new languages, code completion, adding parsing (squiggle underline) support, etc.
What is it?
RSyntaxTextArea is a syntax highlighting text component for Java Swing. It extends JTextComponent so it integrates completely with the standard javax.swing.text package. It is fast and efficient, and can be used in any application that needs to edit or view source code.

RSyntaxTextArea was originally part of the RText programmer's text editor, but is currently being made into a separate component, reusable in any Swing application.

Requires Java 5 or greater.

A forum is now available for questions, comments and feedback. Bug reports should probably go to the project's SourceForge page.

Downloads can be found on SourceForge, or you can grab the bleeding edge from the Subversion repository.

It is available under a modified BSD license.

For a simple example of using RSyntaxTextArea in a Java application, look here.
What's New

Note: Often I forget to update this section. If you're checking it, it's probably better to just keep an eye on our blog to stay up to date on RSyntaxTextArea!


  • Version 2.5.6 of RSyntaxTextArea was just released. This release brings improves rendering performance on OS X in certain instances. Several other features and issues were also added in releases between 2.5.1 and 2.5.6.


  • Version 2.5.1 of RSyntaxTextArea was just released. This release brings improves Clojure syntax highlighting, fixed an exception in certain scenarios when word wrap and code folding were both enabled, and adds support for JLayer/JXLayer as RTextScrollPane views.


  • Version 2.5.0 of RSyntaxTextArea was just released. This release brings rendering improvements, adds syntax highlighting and code folding for .htaccess files, fixes bugs in the Clojure and JavaScript syntax highlighting, and several other small changes. The minimum required JRE has changed to Java 5 from 1.4 as well.



  • Version 2.0.7 of RSyntaxTextArea was just released. This release improves syntax highlighting for web languages (HTML, PHP, JSP, JS), and includes a number of bug fixes and performance improvements. The sister project RSTALanguageSupport saw JSDoc code completion added to JavaScript as well.


  • Version 2.0.6 of RSyntaxTextArea was just released. This release adds JSON syntax highlighting and code folding, makes code completion popup windows and trees use Substance renderers when a Substance Look and Feel is installed, and updates some localizations.


  • Version of RSyntaxTextArea was just released. This release fixes a keyboard shortcut issue found on non-QWERTY keyboards, so it is highly recommended to upgrade if you were using 2.0.5 (2.0.4 and earlier were not affected). The Arabic translation was also updated (thanks Mawaheb!).


  • Version 2.0.5 of RSyntaxTextArea was just released. This release adds code folding for HTML, PHP, and JSP, adds syntax highlighting and code folding for NSIS scripts, and adds code folding for Scala. A few bugs were also fixed.


  • Version of RSyntaxTextArea was just released. This release fixes an Asian font rendering issue introduced in 2.0.4, and adds a couple of keywords that were missing in Groovy syntax highlighting.


  • Version 2.0.4 of RSyntaxTextArea was just released. This release adds lots and lots of new stuff; see this blog post for more information.


  • Version 2.0.2 of RSyntaxTextArea was just released. This fixes all bugs found in 2.0.1 and adds a couple of minor new features.


  • Version 2.0.3 of RSyntaxTextArea was just released. This release adds syntax highlighting and code folding for LaTeX, syntax highlighting for DTD files, fixed a bug when using RSTA in NetBeans' visual editor, and a couple of other bug fixes.


  • Version 2.0.2 of RSyntaxTextArea was just released. This fixes all bugs found in 2.0.1 and adds a couple of minor new features.


  • Version 2.0.1 of RSyntaxTextArea was just released. This is a maintenance release, fixing the minor issues found in 2.0.0.


  • Version 2.0.0 of RSyntaxTextArea has been released at SourceForge! The major changes in 2.0 include:
    1. Code folding added for C, C++, C#, CSS, Groovy, Java, JavaScript, MXML, Perl, and XML.
    2. Support for theming the editor (fonts, colors, etc.) via XML files.
    3. Enhanced syntax highlighting, especially for web languages including HTML, CSS, JavaScript, JSP, and PHP.
    The usual bug fixes and TLC was included as well.


  • Version 2.0.0-beta2 of RSyntaxTextArea has been released at SourceForge! Here are two blog posts outlining all the new stuff in the 2.0 betas.


  • Version 1.5.2 of RSyntaxTextArea has been released at SourceForge! Here's a blog post outlining all the cool new stuff.


  • Version 1.4.0 of RSyntaxTextArea has been released at SourceForge! Check out this blog post to see all of the cool changes!
  • The first official release of the spell checker add-on (version 1.4.0, to go along with the new RSTA version) has also been released! Download it and try it out!
  • The Examples page has been updated for 1.4.0, and a couple more examples have been added. I hope to be adding even more content to this page in the next couple of weeks to address the questions I'm asked most often.


  • Version 1.2.2 of RSyntaxTextArea has been released at SourceForge. This is a minor bugfix release that fixes a few issues that were reported from the field. Check it out!


  • A code completion add-on library has been added to Subversion. While in its early stages, this library still provides an incredible usability boost for people writing IDE's or editors for languages with many keywords, constructs, etc. I hope to have ctags file parsing support integrated into code completion soon.


  • I wasn't planning on doing another "official" release so quickly, but there have been some important enhancements in the flexibility department lately, so I decided to go ahead and get them out there before the holidays in case I get busy. Version 1.2 is not available on SourceForge. This release also fixes an input bug on Macs using a non-English keyboard layout. Thanks to David at Jalbum for pointing out the issue!
  • RSyntaxDocument is no longer hard-coded with what syntax styles it knows about. It now uses a TokenMakerFactory. These factories can be installed on RSyntaxDocuments to change what languages can be syntax highlighted. This helps facilitate adding custom languages, as well as removing built-in languages that are not needed.
  • Since syntax styles are no longer hard-coded into the editor, users can remove any *TokenMaker classes from rsyntaxtextarea.jar that they do not use in their application. This makes for a smaller footprint for the library in many use cases.
  • More changes in SVN to make the editor more configurable. The popup menu is now modifiable via the createPopupMenu() and sePopupMenu() methods. There is also a configurePopupMenu() method that is called whever the popup is about to be displayed, for context-specific modifications, etc. Note that we don't use the 1.5 context menu API added to JComponent since RSyntaxTextArea also runs on 1.4, but our API is slightly more flexible.
  • Code templates can be removed at runtime, not just added.
  • The demo jar is now executable, so double-clicking on it in Windows should launch a standalone version of the demo (it used to be just an applet, so downloading it wasn't very useful).
  • Version 1.1 has been released! You can download it directly from SourceForge. This release includes all of the changes I've outlined in the past couple of months. I've updated the javadoc to reflext this release.
  • Code cleanup.
  • Preparation for smart indent.
  • Expect a 1.1 release very soon.
  • Changing the encoding or line separator of a TextEditorPane now marks the editor as dirty, and listeners are notified.
  • RSyntaxTextAreaDemo changes the source being displayed to match the language being displayed (e.g. Perl source is displayed when "Perl" is selected, etc.).
  • Other minor cleanup.
  • Big changes this time. Don't know how stable SVN is at the moment, but feel free to try it out.
  • Added TextEditorPane class. This is basically a wrapper around RSyntaxTextArea that provides functionality needed in virtually all text editors - loading & saving, managing dirty state of editor, etc. Properties are fired to allow for hosting applications to react to these events.
  • Remote URL's can be loaded & edited in TextEditorPanes, not just local files. This allows for editing files on another machine via FTP, for example. This functionality is not well tested and is not yet guaranteed to always work.
  • Fixed a bug in reading Unicode files if "UTF-16" was the encoding specified to UnicodeReader ("UTF-16LE" and "UTF-16BE" were always fine).
  • Improved hyperlink support. URL highlighting now follows URL spec and should now highlight all (?) hyperlinks. C++ also now supports hyperlinks in comments.
  • Added initial hyperlink support in SVN. Host applications can add javax.swing.text.HyperlinkListeners to the editor and get notified when the user clicks on a hyperlink (e.g. Ctrl+Click). This is done on a per-syntax basis and currently only C and Java support hyperlinks..
  • Added makefile and Ruby syntax highlighting in SVN.
  • Removed from RText and made into its own separate project.