Package javax.swing.text

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


        }

        private void highlight(int offset, HighlightPainter painter) {
            try {
                Highlighter hl = textComponent.getHighlighter();
                Object tag = hl.addHighlight(offset, offset + 1, painter);
                highlights.add(tag);
            }
            catch (BadLocationException ex) {
                // Nothing to do
            }
View Full Code Here


        Pattern p = Pattern.compile(pattern, flags);
        Matcher m = p.matcher(content);
        while (m.find()) {
            for (int i=(m.groupCount()>0?1:0); i<=m.groupCount(); i++) {
                try {
                    highlighter.addHighlight(m.start(i), m.end(i), matchPainter);
                } catch (BadLocationException e) {}
            }
        }
    }
   
View Full Code Here

        } else {
            if (previous != current)
                try {
                    if (current != null) {
                        highlighter.removeHighlight(current);
                        highlighter.addHighlight(current.getStartOffset(), current.getEndOffset(), matchPainter);
                    }
                    highlighter.removeHighlight(previous);
                    highlighter.addHighlight(previous.getStartOffset(), previous.getEndOffset(), selectionPainter);
                    center(previous);
                } catch (BadLocationException ble) {
View Full Code Here

                    if (current != null) {
                        highlighter.removeHighlight(current);
                        highlighter.addHighlight(current.getStartOffset(), current.getEndOffset(), matchPainter);
                    }
                    highlighter.removeHighlight(previous);
                    highlighter.addHighlight(previous.getStartOffset(), previous.getEndOffset(), selectionPainter);
                    center(previous);
                } catch (BadLocationException ble) {
                    // impossible
                }
            pos = previous.getStartOffset();
View Full Code Here

        } else {
            if (next != current)
                try {
                    if (current != null) {
                        highlighter.removeHighlight(current);
                        highlighter.addHighlight(current.getStartOffset(), current.getEndOffset(), matchPainter);
                    }
                    highlighter.removeHighlight(next);
                    highlighter.addHighlight(next.getStartOffset(), next.getEndOffset(), selectionPainter);
                    center(next);
                } catch (BadLocationException ble) {
View Full Code Here

                    if (current != null) {
                        highlighter.removeHighlight(current);
                        highlighter.addHighlight(current.getStartOffset(), current.getEndOffset(), matchPainter);
                    }
                    highlighter.removeHighlight(next);
                    highlighter.addHighlight(next.getStartOffset(), next.getEndOffset(), selectionPainter);
                    center(next);
                } catch (BadLocationException ble) {
                    // impossible
                }
            pos = next.getStartOffset();
View Full Code Here

    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

    }
    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

      }

      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

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.