Package com.swabunga.spell.event

Examples of com.swabunga.spell.event.DocumentWordTokenizer


*/
  public synchronized int spellCheck(JTextComponent textComp) {
   
    this.textComponent = textComp;

    DocumentWordTokenizer tokenizer = new DocumentWordTokenizer(textComp.getDocument());
    int exitStatus = spellCheck.checkSpelling(tokenizer);

    //textComp.requestFocus();
    //textComp.setCaretPosition(0);
    this.textComponent = null;
View Full Code Here


 
  private void markupSpelling(StyledDocument doc, int start, int end){
    int            wordStart=-1,
                wordEnd=-1;
    String          word;
    DocumentWordTokenizer  docTok;
    @SuppressWarnings("unused")
    Segment          seg=new Segment();
   
    docTok=new DocumentWordTokenizer(doc);
    if(start>0){
      docTok.posStartFullWordFrom(start);
    }
   
    while(docTok.hasMoreWords() && docTok.getCurrentWordPosition()<=end){
      word=docTok.nextWord();
      wordStart=docTok.getCurrentWordPosition();
     
      // Mark non word parts (spaces) as correct
      if(wordEnd!=-1){
        //System.out.println("Space:"+wordEnd+","+wordStart);
        markAsCorrect(doc, wordEnd, wordStart);
      }
      wordEnd=docTok.getCurrentWordEnd();
     
      if(wordEnd>doc.getLength())
        wordEnd=doc.getLength()-1;
      if(wordStart>=wordEnd)
        continue;
View Full Code Here

  private void showSuggestionPopup(JEditorPane pane, Point p){
    StyledDocument       doc;
    JMenuItem         item;
    AttributeSet      attr;
    int           pos = pane.viewToModel(p);
    DocumentWordTokenizer  docTok;
    String          word;
    java.util.List      suggestions;
    JPopupMenu         popup;
    ReplaceListener      repList;
   
    if (pos >= 0) {
      doc=(StyledDocument)pane.getDocument();
      attr=doc.getCharacterElement(pos).getAttributes();
      if(attr.containsAttribute(wordMisspelled, wordMisspelledTrue)){
        docTok=new DocumentWordTokenizer(doc);
        docTok.posStartFullWordFrom(pos);
        word=docTok.nextWord();
        suggestions=sCheck.getSuggestions(word, config.getInteger(Configuration.SPELL_THRESHOLD));
       
        popup=new JPopupMenu();
        repList=new ReplaceListener(docTok);
        for(int i=0;i<suggestions.size();i++) {
View Full Code Here

TOP

Related Classes of com.swabunga.spell.event.DocumentWordTokenizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.