JOrtho (Java Spell checker) Example

[Last Updated: Dec 30, 2018]

Java Swing 

This example shows how to use JOrtho Spell checker with Java Swing text components.

(1) Download JOrtho library jar and a dictionary (e.g. from here.

(2) Installed JOrtho jar to your local .m2 folder using:

mvn install:install-file -Dfile="D:\thirdParty\jortho.jar" -DgroupId=com.inet.jortho -DartifactId=jortho -Dversion=1.0 -Dpackaging=jar

(3) Create a simple project from your IDE or using maven-archetype-quickstart

(4) Put your dictionary file ending with extension ortho in resource folder (project-root/src/resources)

(5) Create file dictionary.cnf in resource folder (project-root/src/resources). Specify comma separated language codes (e.g. 'en')


(6) Now create Java Classes. The JOrtho code will look like this:

SpellChecker.setUserDictionaryProvider(new FileUserDictionary());

SpellChecker.registerDictionaries( JorthoExample.class.getResource("/dictionary"), "en");

SpellCheckerOptions sco=new SpellCheckerOptions();

JPopupMenu popup = SpellChecker.createCheckerPopup(sco);

You can also invoke a spell checker dialog instead of using JPopup menu.

SpellChecker.showSpellCheckerDialog( ui.getTextComponent(), sco );

Dependencies and Technologies Used:

  • com.inet.jortho:jortho 1.0: POM was created from install:install-file.
  • JDK 1.8
  • Maven 3.0.4

jortho-example Select All Download
  • jortho-example
    • src
      • main
        • java
          • com
            • logicbig
              • example
          • resources

    Please note dictionary_en.ortho is not included in the above project download, get it from here. Also you have to download the library jar from the same location.

    See Also