Mercurial Hosting > editor
view src/luan_editor/SpellCheckerLuan.java @ 37:b7ff52d45b9a default tip
copy from luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 21 Apr 2025 13:07:29 -0600 |
parents | |
children |
line wrap: on
line source
package luan_editor; import java.net.URL; import java.net.MalformedURLException; import javax.swing.text.JTextComponent; import com.inet.jortho.SpellChecker; import com.inet.jortho.DefaultMessageHandler; import luan.LuanException; import luan.LuanRuntimeException; public class SpellCheckerLuan { public static void registerDictionaries( String baseURL, String activeLocale) throws MalformedURLException, LuanException { SpellChecker.setMessageHandler(new DefaultMessageHandler(null) { @Override public void handleException(java.lang.Throwable throwable) { throw new LuanRuntimeException(new LuanException(throwable)); } } ); URL url = new URL(baseURL); try { SpellChecker.registerDictionaries( url, activeLocale ); } catch(LuanRuntimeException e) { LuanException luanException = (LuanException)e.getCause(); throw luanException; } } public static void register(JTextComponent text) { SpellChecker.register(text); } public static void unregister(JTextComponent text) { SpellChecker.unregister(text); } }