Examples of Highlighter


Examples of javax.swing.text.Highlighter

        assertTrue(caret instanceof DefaultCaret);
        assertTrue(caret instanceof UIResource);
    }

    public void testBasicHighlighter() {
        Highlighter highlighter = new BasicTextUI.BasicHighlighter();
        assertTrue(highlighter instanceof DefaultHighlighter);
        assertTrue(highlighter instanceof UIResource);
    }
View Full Code Here

Examples of javax.swing.text.Highlighter

    public void testGetComponent() {
        assertEquals(jta, ((BasicTextUI) jta.getUI()).getComponent());
    }

    public void testCreateHighlighter() {
        Highlighter highlighter = basicTextUI.createHighlighter();
        assertTrue(highlighter instanceof BasicTextUI.BasicHighlighter);
    }
View Full Code Here

Examples of javax.swing.text.Highlighter

        new javax.swing.JTextPane().updateUI();           
    }

    public void testInstallUI() throws Exception {
        Caret caret = jta.getCaret();
        Highlighter highlighter = jta.getHighlighter();
        String prefix = ((BasicTextUI) tf.getUI()).getPropertyPrefix();
        (jta.getUI()).uninstallUI(jta);
        TextUI ui = jta.getUI();
        assertTrue(ui instanceof TextAreaUI);
        TextAreaUI.callOrder = "";
View Full Code Here

Examples of javax.swing.text.Highlighter

        assertTrue(caret instanceof DefaultCaret);
        assertTrue(caret instanceof UIResource);
    }

    public void testBasicHighlighter() {
        Highlighter highlighter = new BasicTextUI.BasicHighlighter();
        assertTrue(highlighter instanceof DefaultHighlighter);
        assertTrue(highlighter instanceof UIResource);
    }
View Full Code Here

Examples of javax.swing.text.Highlighter

  protected final void highlight(JTextComponent comp, int i, int j) {
    highlight(comp, i, j, true);
  }

  protected void highlight(JTextComponent comp, int i, int j, boolean scroll) {
    Highlighter highlighter = comp.getHighlighter();
    highlighter.removeAllHighlights();

    try {
      i = toComponentPosition(comp, i);
      j = toComponentPosition(comp, j);
      highlighter.addHighlight(i, j+1, DefaultHighlighter.DefaultPainter);
      if (scroll) {
        if (comp.getCaretPosition() < i || comp.getCaretPosition() > j) {
          comp.moveCaretPosition(i);
          comp.scrollRectToVisible(comp.modelToView(i));
        }
View Full Code Here

Examples of javax.swing.text.Highlighter

            return linkPos != -1 ? doc.getCharacterElement(linkPos) : null;
        }

        private static void moveHighlight(final JEditorPane editor,
                                          final int start, final int end) {
            Highlighter highlighter = editor.getHighlighter();
            Object tag = highlightTags.get(highlighter);
            if (tag != null) {
                highlighter.removeHighlight(tag);
                highlightTags.remove(highlighter);
            }
            try {
                tag = highlighter.addHighlight(start, end,
                                               new LinkHighlightPainter());
                highlightTags.put(highlighter, tag);
                editor.getCaret().setDot(start);
            } catch (final BadLocationException e) {
            }
View Full Code Here

Examples of javax.swing.text.Highlighter

            } catch (final BadLocationException e) {
            }
        }

        static void removeHighlight(final JEditorPane editor) {
            Highlighter highlighter = editor.getHighlighter();
            Object tag = highlightTags.get(highlighter);
            if (tag != null) {
                highlighter.removeHighlight(tag);
                highlightTags.remove(highlighter);
            }
        }
View Full Code Here

Examples of javax.swing.text.Highlighter

    public void paint(final Graphics g, final Shape shape) {
        Rectangle rc = shape.getBounds();

        // TODO change layered highlight painting code
        JTextComponent tc = (JTextComponent)getContainer();
        Highlighter hl = tc.getHighlighter();
        if (hl instanceof LayeredHighlighter) {
            ((LayeredHighlighter)hl).paintLayeredHighlights(g,
                                                            getStartOffset(),
                                                            getEndOffset(),
                                                            shape, tc, this);
View Full Code Here

Examples of javax.swing.text.Highlighter

    int dot = tc.getCaretPosition();
    int selStart = tc.getSelectionStart()-1; // Workaround for Java Highlight issues.
    Highlight currentPrev = null;
    int pos = 0;
    Highlighter h = tc.getHighlighter();
    Highlight[] highlights = h.getHighlights();
    for (int i=0; i<highlights.length; i++) {
      Highlight hl = highlights[i];
      if (hl.getPainter()==p) { // Only way to identify our own highlights
        if (currentPrev==null || currentPrev.getStartOffset()>=dot ||
            (hl.getStartOffset()<selStart &&
View Full Code Here

Examples of javax.swing.text.Highlighter

  /**
   * Removes the bounding boxes around parameters.
   */
  private void removeParameterHighlights() {
    JTextComponent tc = ac.getTextComponent();
    Highlighter h = tc.getHighlighter();
    for (int i=0; i<tags.size(); i++) {
      h.removeHighlight(tags.get(i));
    }
    tags.clear();
  }
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.