public class CheckerListener extends java.lang.Object implements javax.swing.event.PopupMenuListener, LanguageChangeListener
Constructor and Description |
---|
CheckerListener(javax.swing.JComponent menu,
SpellCheckerOptions options)
Create a PopupMenuListener
|
Modifier and Type | Method and Description |
---|---|
protected void |
addMenuItemAddToDictionary(javax.swing.text.JTextComponent jText,
java.lang.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(javax.swing.text.JTextComponent jText,
int begOffs,
int endOffs,
java.util.List<com.inet.jortho.Suggestion> list,
boolean needCapitalization)
Add menu items to the with suggestions to the menu.
|
protected int |
getCursorPosition(javax.swing.text.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(javax.swing.event.PopupMenuEvent e) |
void |
popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent e) |
void |
popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent ev) |
public CheckerListener(javax.swing.JComponent menu, SpellCheckerOptions options)
menu
- a JMenu or JPopuupoptions
- current spell checker optionspublic void popupMenuCanceled(javax.swing.event.PopupMenuEvent e)
popupMenuCanceled
in interface javax.swing.event.PopupMenuListener
public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent e)
popupMenuWillBecomeInvisible
in interface javax.swing.event.PopupMenuListener
public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent ev)
popupMenuWillBecomeVisible
in interface javax.swing.event.PopupMenuListener
protected int getCursorPosition(javax.swing.text.JTextComponent jText) throws javax.swing.text.BadLocationException
jText
- current JTextComponentjavax.swing.text.BadLocationException
- should never occurprotected void addSuggestionMenuItem(javax.swing.text.JTextComponent jText, int begOffs, int endOffs, java.util.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(javax.swing.text.JTextComponent jText, java.lang.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 © 2005 - 2013 i-net software. All Rights Reserved.