Package javax.swing.text

Examples of javax.swing.text.Highlighter.addHighlight()


                    wholeWord, regex);
      while (found) {
        int start = getSelectionStart();
        int end = getSelectionEnd();
        try {
          markAllHighlights.add(h.addHighlight(start, end,
                    markAllHighlightPainter));
        } catch (BadLocationException ble) {
          ble.printStackTrace();
        }
        numMarked++;
View Full Code Here


                firstCodeFileInfo = codeFileInfo;
                firstSnippet = snippets[0];
            }
            for (Snippet snippet : snippets) {
                try {
                    highlighter.addHighlight(snippet.startLine,
                            snippet.endLine, snippetPainter );
                    codeFileInfo.veneer.repaint();
                } catch (BadLocationException e) {
                    e.printStackTrace();
                }
View Full Code Here

      startPos= text.indexOf('\n', startPos) + 1;
    }
    endPos= text.indexOf('\n', startPos) + 1;

    try {
      hLiter.addHighlight(startPos, endPos, painter);
    } catch (BadLocationException e) {
      // ignore it, but clear everything. This has to do with
      // not knowing the actual pseuco file
      input.getHighlighter().removeAllHighlights();
    }
View Full Code Here



    for (Span span : grammarErrors) {
      try {
        h.addHighlight(span.start, span.end, bhp);
      } catch (BadLocationException ex) {
        //Tools.showError(ex);
      }
    }
    for (Span span : spellErrors) {
View Full Code Here

        //Tools.showError(ex);
      }
    }
    for (Span span : spellErrors) {
      try {
        h.addHighlight(span.start, span.end, rhp);
      } catch (BadLocationException ex) {
        //Tools.showError(ex);
      }
    }
  }
View Full Code Here

    public void setHighlightedLine(int pos) {
        try {
            Highlighter h = this.getTextComponent().getHighlighter();
            int start = this.getTextComponent().getLineStartOffset(pos);
            int end = this.getTextComponent().getLineEndOffset(pos);
            h.addHighlight(start, end, highlighter);
        } catch (BadLocationException ex) {
            Logger.getLogger(TextHighlighter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
View Full Code Here

            int pos = 0;

            // Search for pattern
            while ((pos = text.indexOf(pattern, pos)) >= 0) {
                // Create highlighter using private painter and apply around pattern
                hilite.addHighlight(pos, pos + pattern.length(), highlighter);
                pos += pattern.length();
            }
        } catch (BadLocationException e) {
        }
    }
View Full Code Here

      final Tokenizer tok = new Tokenizer(jText, dic, loc, i, j, options);
      String word;
      final Highlighter highlighter = jText.getHighlighter();
      while ((word = tok.nextInvalidWord()) != null) {
        final int wordOffset = tok.getWordOffset();
        highlighter.addHighlight(wordOffset, wordOffset + word.length(), painter);
      }
    }
    catch (final BadLocationException e) {
      e.printStackTrace();
    }
View Full Code Here

      try {
       
        if (pos.getEndPosition() > Integer.MAX_VALUE)
          break;
       
        highlighter.addHighlight((int) pos.getStartPosition(),
                 (int) pos.getEndPosition(), painter);
       
      } catch (BadLocationException e) {
      }
    }
View Full Code Here

      boolean found = SearchEngine.find(this, context);
      while (found) {
        int start = getSelectionStart();
        int end = getSelectionEnd();
        try {
          markAllHighlights.add(h.addHighlight(start, end,
                    markAllHighlightPainter));
        } catch (BadLocationException ble) {
          ble.printStackTrace();
        }
        numMarked++;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.