Examples of Highlighter


Examples of br.com.digilabs.jqplot.elements.Highlighter

    return seriesColors;
  }

  public Highlighter highlighterInstance() {
    if (highlighter == null) {
      highlighter = new Highlighter();
    }
    return highlighter;
  }
View Full Code Here

Examples of javax.swing.text.Highlighter

            // First remove all old highlights
            removeHighlights(textComp);
        }

        try {
            final Highlighter hilite = textComp.getHighlighter();
            final Document doc = textComp.getDocument();
            String text = doc.getText(0, doc.getLength());
            if( matchAnyCase ) {
                text = text.toLowerCase();
            }
            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(), myHighlightPainter);
                pos += pattern.length();
            }
        } catch (final BadLocationException e) {
        }
    }
View Full Code Here

Examples of javax.swing.text.Highlighter

            // First remove all old highlights
            removeHighlights(textComp);
        }

        try {
            final Highlighter hilite = textComp.getHighlighter();
            hilite.addHighlight(pos, pos+len, myHighlightPainter);
        } catch (final BadLocationException e) {
        }
    }
View Full Code Here

Examples of javax.swing.text.Highlighter

        }
    }

    // Removes only our private highlights
    public void removeHighlights(final JTextComponent textComp) {
        final Highlighter hilite = textComp.getHighlighter();
        final Highlighter.Highlight[] hilites = hilite.getHighlights();

        for( final Highlight element : hilites ) {
            if (element.getPainter() instanceof MyHighlightPainter) {
                hilite.removeHighlight(element);
            }
        }
    }
View Full Code Here

Examples of javax.swing.text.Highlighter

      highlight(m.template, r.a, r.b);
    }
  }

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

    try {
      highlighter.addHighlight(i, j+1, DefaultHighlighter.DefaultPainter);
    }
    catch (BadLocationException ble) {
      errMgr.internalError(tmodel.root.event.scope.st, "bad highlight location", ble);
    }
  }
View Full Code Here

Examples of javax.swing.text.Highlighter

    MyHighlightPainter myHighlightPainter = new MyHighlightPainter(Color.yellow);
   
    removeHighlights(textComp);
    if (pattern.length() > 0)
      try {
        Highlighter hilite = textComp.getHighlighter();
        Document doc = textComp.getDocument();
        String text = doc.getText(0, doc.getLength());
        text = text.toUpperCase();
        pattern = pattern.toUpperCase();
        int pos = textComp.getCaretPosition();
        if ((pos = text.indexOf(pattern, pos)) != -1)
          if (findAll == 0) {
            hilite.addHighlight(pos, pos + pattern.length(), myHighlightPainter);
            textComp.setCaretPosition(pos + pattern.length());
            textComp.setSelectionStart(pos);
            textComp.setSelectionEnd(pos + pattern.length());
          } else {
            for (; (pos = text.indexOf(pattern, pos)) >= 0; pos += pattern.length())
              hilite.addHighlight(pos, pos + pattern.length(), myHighlightPainter);

          }
      } catch (BadLocationException badlocationexception) {
      }
  }
View Full Code Here

Examples of javax.swing.text.Highlighter

  }

  private static void removeHighlights(JTextComponent textComp) {
    @SuppressWarnings("unused")
    MyHighlightPainter myHighlightPainter = new MyHighlightPainter(Color.yellow);
    Highlighter hilite = textComp.getHighlighter();
    javax.swing.text.Highlighter.Highlight hilites[] = hilite.getHighlights();
    for (int i = 0; i < hilites.length; i++)
      if (hilites[i].getPainter() instanceof MyHighlightPainter)
        hilite.removeHighlight(hilites[i]);
  }
View Full Code Here

Examples of javax.swing.text.Highlighter

        if (textToHighlight.equals("")) {
            return;
        }

        // remove previous higlights
        Highlighter highlighter = editorPane.getHighlighter();
        highlighter.removeAllHighlights();

        // get the text desplayed on the pane
        String text = "";
        Document doc = editorPane.getDocument();
        try {
            text = doc.getText(0, doc.getLength()).toLowerCase();
        } catch (BadLocationException e1) {
            Debug.error(e1);
            return;
        }

        // find the indexes of the given text in the document
        ArrayList<Integer> result = indexesOf(text, textToHighlight);

        // set the highlights depending on the indexies has been found
        for (Iterator iter = result.iterator(); iter.hasNext();) {
            Integer element = (Integer) iter.next();
            try {
                highlighter.addHighlight(element.intValue(), element.intValue() + textToHighlight.length(), new DefaultHighlighter.DefaultHighlightPainter(Color.yellow));
            } catch (BadLocationException e) {
                Debug.error(e);
            }
        }
    }
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
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.