AutoComplete added to Subversion

I’ve gone ahead and added the AutoComplete project and its demo project to the RSyntaxTextArea Subversion repository.  Consider this to be a very early preview release.  Feedback is more than welcome, but please keep in mind that this is very much a work in progress!

AutoComplete can work on any JTextComponent.  It does not require RSyntaxTextArea.  But moving forward, it will come with built-in support for RSyntaxTextArea (it will be able to key off of its document parsing to deliver more intelligent completion choices, for example).  But feel free to use it in JTextFields or whatever else you want to use it in.

Javadoc for this early preview is here.  Check out the AutoCompleteDemo application for example usage.  The current simplest usage (just completion of simple words) is:


String[] words = new String[] { "aardvark", "angela", "apparel", "apple", "axe" };
WordCompletionProvider provider = new WordCompletionProvider(words);
AutoCompletion ac = new AutoCompletion(provider);
ac.setShowDescWindow(false);
ac.install(myTextComponent);

This will add autocompletion support for the words in the words array to myTextComponent. Simple as that. AutoCompleteDemo is a more complex example, providing autocompletion for the standard C library, complete with summaries of each method (see the screenshots below).

The code only requires Java 1.4 or greater to run, so practically everyone should be able to use it.  The license is LGPL, just like RSyntaxTextArea.

Comments are closed.