public class CheckerListener extends Object implements PopupMenuListener, LanguageChangeListener
Constructor and Description |
---|
CheckerListener(JComponent menu,
SpellCheckerOptions options)
Create a PopupMenuListener
|
Modifier and Type | Method and Description |
---|---|
protected void |
addMenuItemAddToDictionary(JTextComponent jText,
String word,
boolean addSeparator)
Add the menu item "Add to Dictionary" at the end of the menu if a user dictionary is available.
|
protected void |
addSuggestionMenuItem(JTextComponent jText,
int begOffs,
int endOffs,
List<com.inet.jortho.Suggestion> list,
boolean needCapitalization)
Add menu items to the with suggestions to the menu.
|
protected int |
getCursorPosition(JTextComponent jText)
Get the cursor position for the popup menu
|
void |
languageChanged(LanguageChangeEvent ev)
This method gets called when the language is changed.
|
void |
popupMenuCanceled(PopupMenuEvent e) |
void |
popupMenuWillBecomeInvisible(PopupMenuEvent e) |
void |
popupMenuWillBecomeVisible(PopupMenuEvent ev) |
public CheckerListener(JComponent menu, SpellCheckerOptions options)
menu
- a JMenu or JPopuupoptions
- current spell checker optionspublic void popupMenuCanceled(PopupMenuEvent e)
popupMenuCanceled
in interface PopupMenuListener
public void popupMenuWillBecomeInvisible(PopupMenuEvent e)
popupMenuWillBecomeInvisible
in interface PopupMenuListener
public void popupMenuWillBecomeVisible(PopupMenuEvent ev)
popupMenuWillBecomeVisible
in interface PopupMenuListener
protected int getCursorPosition(JTextComponent jText) throws BadLocationException
jText
- current JTextComponentBadLocationException
- should never occurprotected void addSuggestionMenuItem(JTextComponent jText, int begOffs, int endOffs, List<com.inet.jortho.Suggestion> list, boolean needCapitalization)
jText
- current JTextComponentbegOffs
- offset of the current word in the JTextComponent, need for replacementendOffs
- end of the current word in the JTextComponent, need for replacementlist
- a list with suggestionsneedCapitalization
- if the first letter of the suggestion should capitalizedprotected void addMenuItemAddToDictionary(JTextComponent jText, String word, boolean addSeparator)
jText
- current JTextComponentword
- current word, which can be addaddSeparator
- true, add a separator before the menu itempublic void languageChanged(LanguageChangeEvent ev)
languageChanged
in interface LanguageChangeListener
ev
- A LanguageChangeEvent object describing the changes.Copyright © 2016. All rights reserved.