javax.swing.JEditorPane.getHighlighter()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中javax.swing.JEditorPane.getHighlighter()方法的一些代码示例,展示了JEditorPane.getHighlighter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.getHighlighter()方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:getHighlighter

JEditorPane.getHighlighter介绍

暂无

代码示例

代码示例来源:origin: org.sonarsource.sslr/sslr-toolkit

@Override
public void clearSourceCodeHighlights() {
 sourceCodeEditorPane.getHighlighter().removeAllHighlights();
}

代码示例来源:origin: SonarSource/sslr

@Override
public void clearSourceCodeHighlights() {
 sourceCodeEditorPane.getHighlighter().removeAllHighlights();
}

代码示例来源:origin: org.codehaus.sonar.sslr/sslr-toolkit

@Override
public void clearSourceCodeHighlights() {
 sourceCodeEditorPane.getHighlighter().removeAllHighlights();
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

_highlightTag = editor.getHighlighter().addHighlight( i, i + 1, HIGHLIGHTER );
_highlightTag2 = editor.getHighlighter().addHighlight( initial, initial + 1, HIGHLIGHTER );

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

_highlightTag = editor.getHighlighter().addHighlight( i, i + 1, HIGHLIGHTER );
_highlightTag2 = editor.getHighlighter().addHighlight( initial, initial + 1, HIGHLIGHTER );

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

_highlightTag = editor.getHighlighter().addHighlight( i, i + 1, HIGHLIGHTER );
_highlightTag2 = editor.getHighlighter().addHighlight( initial, initial + 1, HIGHLIGHTER );

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

_highlightTag = editor.getHighlighter().addHighlight( i, i + 1, HIGHLIGHTER );
_highlightTag2 = editor.getHighlighter().addHighlight( initial, initial + 1, HIGHLIGHTER );

代码示例来源:origin: stackoverflow.com

javax.swing.text.DefaultHighlighter.DefaultHighlightPainter highlightPainter =
    new javax.swing.text.DefaultHighlighter.DefaultHighlightPainter(Color.YELLOW);
editor.getHighlighter().addHighlight(index, index + find.length(),
    highlightPainter);

代码示例来源:origin: igniterealtime/Spark

String match = line.substring(i, i + text.length());
if (text.equalsIgnoreCase(match)) {
  window.getHighlighter().addHighlight(globalPos + i,
      globalPos + i + text.length(), highlighter);

代码示例来源:origin: org.codehaus.sonar.sslr/sslr-devkit

private void highlightSelectedPaths() {
 codeEditor.getHighlighter().removeAllHighlights();
 TreePath[] selectedPaths = astTree.getSelectionPaths();
 if (selectedPaths != null) {
  for (TreePath selectedPath : selectedPaths) {
   DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) selectedPath.getLastPathComponent();
   AstNode astNode = getAstNodeFromUserObject(treeNode.getUserObject());
   try {
    Token firstToken = astNode.getToken();
    Token lastToken = astNode.getLastToken();
    codeEditor.getHighlighter().addHighlight(lineOffsets.getStartOffset(firstToken), lineOffsets.getEndOffset(lastToken),
      new DefaultHighlighter.DefaultHighlightPainter(Color.LIGHT_GRAY));
   } catch (BadLocationException e) {
    LOG.error("Error with the highlighter", e);
   }
  }
 }
}

代码示例来源:origin: org.sonarsource.sslr/sslr-toolkit

@Override
public void highlightSourceCode(AstNode astNode) {
 Objects.requireNonNull(astNode);
 if (!astNode.hasToken()) {
  return;
 }
 Token startToken = astNode.getToken();
 Token endToken = astNode.getLastToken();
 int startOffset = getValidDocumentOffsetFromSourceCodeOffset(lineOffsets.getStartOffset(startToken));
 int endOffset = getValidDocumentOffsetFromSourceCodeOffset(lineOffsets.getEndOffset(endToken));
 try {
  sourceCodeEditorPane.getHighlighter().addHighlight(startOffset, endOffset, highlighter);
 } catch (BadLocationException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.codehaus.sonar.sslr/sslr-toolkit

@Override
public void highlightSourceCode(AstNode astNode) {
 checkNotNull(astNode);
 if (!astNode.hasToken()) {
  return;
 }
 Token startToken = astNode.getToken();
 Token endToken = astNode.getLastToken();
 int startOffset = getValidDocumentOffsetFromSourceCodeOffset(lineOffsets.getStartOffset(startToken));
 int endOffset = getValidDocumentOffsetFromSourceCodeOffset(lineOffsets.getEndOffset(endToken));
 try {
  sourceCodeEditorPane.getHighlighter().addHighlight(startOffset, endOffset, highlighter);
 } catch (BadLocationException e) {
  throw Throwables.propagate(e);
 }
}

代码示例来源:origin: SonarSource/sslr

@Override
public void highlightSourceCode(AstNode astNode) {
 Objects.requireNonNull(astNode);
 if (!astNode.hasToken()) {
  return;
 }
 Token startToken = astNode.getToken();
 Token endToken = astNode.getLastToken();
 int startOffset = getValidDocumentOffsetFromSourceCodeOffset(lineOffsets.getStartOffset(startToken));
 int endOffset = getValidDocumentOffsetFromSourceCodeOffset(lineOffsets.getEndOffset(endToken));
 try {
  sourceCodeEditorPane.getHighlighter().addHighlight(startOffset, endOffset, highlighter);
 } catch (BadLocationException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

editor.getHighlighter().removeHighlight( _highlightTag );
editor.getHighlighter().removeHighlight( _highlightTag2 );
_highlightTag = null;
_highlightTag2 = null;

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

editor.getHighlighter().removeHighlight( _highlightTag );
editor.getHighlighter().removeHighlight( _highlightTag2 );
_highlightTag = null;
_highlightTag2 = null;

代码示例来源:origin: javax.help/javahelp

Highlighter h = html.getHighlighter();
debug1("removeAllHighlights");
h.removeAllHighlights();

代码示例来源:origin: javax.help/javahelp

private void rebuild() {
  debug("rebuild");
  TextHelpModel model = theViewer.getModel();
  if (model == null) {
    debug("rebuild-end: model is null");
    return;
  }
  // The model has changed. I'll need to clear the HTML viewer and
  // put in the home page
  Highlighter h = html.getHighlighter();
  debug("removeAllHighlights");
  h.removeAllHighlights();
  HelpSet hs = model.getHelpSet();
  // for glossary - not set homeID page - glossary is not synchronized
  if(theViewer.getSynch()){
    try {
      Map.ID homeID = hs.getHomeID();
      Locale locale = hs.getLocale();
      String name = HelpUtilities.getString(locale, "history.homePage");
      model.setCurrentID(homeID, name, (JHelpNavigator)null);
      html.setPage(model.getCurrentURL());
    } catch (Exception e) {
      // ignore
    }
  }
  debug("rebuild-end");
}

代码示例来源:origin: javax.help/javahelp

Highlighter h = html.getHighlighter();
debug("removeAllHighlights");
h.removeAllHighlights();

相关文章

JEditorPane类方法