Examples of addHighlight()


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

    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

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

            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

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

      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

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

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

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

      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

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

    codeEditor.setEditable(false);

    Highlighter hl = codeEditor.getHighlighter();
    Object o = null;
    try {
      o = hl.addHighlight(0, 0, CURRENT_LINE_MARKER);
    } catch (BadLocationException e1) {
    }
    currentLineTag = o;

    o = null;
View Full Code Here

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

    }
    currentLineTag = o;

    o = null;
    try {
      o = hl.addHighlight(0, 0, SELECTED_LINE_MARKER);
    } catch (BadLocationException e1) {
    }
    selectedLineTag = o;

    codeEditor.getComponentPopupMenu().addPopupMenuListener(new PopupMenuListener() {
View Full Code Here

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

      }

      final int start = codeEditorLines.get(w.getLineNumber());
      int end = codeEditorLines.get(w.getLineNumber()+1);
      try {
        breakpointsLineTags.add(hl.addHighlight(start, end, BREAKPOINTS_MARKER));
      } catch (BadLocationException e1) {
      }
    }
  }
View Full Code Here

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

            int start = 0;

            for (String line : getText().split("\n")){
                Matcher matcher = pattern.matcher(line);
                while(matcher.find()){
                    hilite.addHighlight(start + matcher.start(), start + matcher.end(), highlightPainter);
                }
                start += line.length() + 1;
            }

        } catch (BadLocationException e) {
View Full Code Here

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

            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(), highlightPainter);
                pos += pattern.length();
            }
        } catch (BadLocationException e) {

        }
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.