當前位置: 首頁>>代碼示例>>Java>>正文


Java Highlighter.removeHighlight方法代碼示例

本文整理匯總了Java中javax.swing.text.Highlighter.removeHighlight方法的典型用法代碼示例。如果您正苦於以下問題:Java Highlighter.removeHighlight方法的具體用法?Java Highlighter.removeHighlight怎麽用?Java Highlighter.removeHighlight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.text.Highlighter的用法示例。


在下文中一共展示了Highlighter.removeHighlight方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateSelection

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
private void updateSelection() {
    Highlighter h = component.getHighlighter();
    if (h != null) {
        int p0 = Math.min(dot, mark);
        int p1 = Math.max(dot, mark);

        if (p0 == p1 || !selectionVisible) {
            if (selectionTag != null) {
                h.removeHighlight(selectionTag);
                selectionTag = null;
            }
        } else {
            try {
                if (selectionTag != null) {
                    h.changeHighlight(selectionTag, p0, p1);
                } else {
                    Highlighter.HighlightPainter p = getSelectionPainter();
                    selectionTag = h.addHighlight(p0, p1, p);
                }
            } catch (BadLocationException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:CaretFloatingPointAPITest.java

示例2: moveHighlight

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
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) {
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:17,代碼來源:HTMLEditorKit.java

示例3: setHighlightedText

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
public synchronized void setHighlightedText(final DefaultHighlightPainter painter,
                                            final TextLocation startLocation,
                                   @SuppressWarnings("unused") final TextLocation endLocation) {
    final Highlighter highlighter = getHighlighter();
    if (currentHighlight != null) {
        highlighter.removeHighlight(currentHighlight);
        currentHighlight = null;
    }
    if (startLocation == null) {
        return;
    }
    final int line = startLocation.getLine() - 1;
    if (line >= 0) {
        try {
            final int start = getLineStartOffset(line);
            final int end = getLineEndOffset(line);
            currentHighlight = highlighter.addHighlight(start, end, painter);
        } catch (final BadLocationException e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:sverrehu,項目名稱:basus,代碼行數:23,代碼來源:Editor.java

示例4: removeParameterHighlights

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * 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();
	for (ParamCopyInfo pci : paramCopyInfos) {
		h.removeHighlight(pci.h);
	}
	paramCopyInfos.clear();
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:16,代碼來源:ParameterizedCompletionContext.java

示例5: removeHighlights

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/*****************************************
* removeHighlights
* remove all high lights from the pane
* @return void
*****************************************/
public void removeHighlights() {
    JTextComponent textComp = this.textPane;
    Highlighter hilite = textComp.getHighlighter();
    Highlighter.Highlight[] hilites = hilite.getHighlights();
    for (int i=0; i<hilites.length; i++) {
        if (hilites[i].getPainter() instanceof MyHighlightPainter){
            hilite.removeHighlight(hilites[i]);
        }
    }
}
 
開發者ID:fcpauldiaz,項目名稱:Compilador,代碼行數:16,代碼來源:TextPanel.java

示例6: removeHighlights

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/*****************************************
* removeHighlights
* remove all high lights from the pane
*****************************************/
public void removeHighlights() {
    JTextComponent textComp = this.textPane;
    Highlighter hilite = textComp.getHighlighter();
    Highlighter.Highlight[] hilites = hilite.getHighlights();
    for (Highlighter.Highlight hilite1 : hilites) {
        if (hilite1.getPainter() instanceof MyHighlightPainter) {
            hilite.removeHighlight(hilite1);
        }
    }
}
 
開發者ID:fcpauldiaz,項目名稱:Compilador,代碼行數:15,代碼來源:TextPanel.java

示例7: removeParameterHighlights

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * 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();
	for (ParamCopyInfo pci : paramCopyInfos) {
		h.removeHighlight(pci.h);
	}
	paramCopyInfos.clear();
}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:16,代碼來源:ParameterizedCompletionContext.java

示例8: clearMarkAllHighlights

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * Clears any "mark all" highlights, if any.
 * 
 * @see #markAll
 * @see #getMarkAllHighlightColor
 * @see #setMarkAllHighlightColor
 */
public void clearMarkAllHighlights() {
    Highlighter h = getHighlighter();
    if (h != null && markAllHighlights != null) {
        int count = markAllHighlights.size();
        for (int i = 0; i < count; i++)
            h.removeHighlight(markAllHighlights.get(i));
        markAllHighlights.clear();
    }
    markedWord = null;
    repaint();
}
 
開發者ID:intuit,項目名稱:Tank,代碼行數:19,代碼來源:RTextArea.java

示例9: removeHighlights

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * Removes only our private highlights
 */
@Action
public void removeHighlights() {
    Highlighter hilite = jTextAreaEntry.getHighlighter();
    Highlighter.Highlight[] hilites = hilite.getHighlights();
    for (Highlighter.Highlight hilite1 : hilites) {
        if (hilite1.getPainter() instanceof MyHighlightPainter) {
            hilite.removeHighlight(hilite1);
        }
    }
}
 
開發者ID:sjPlot,項目名稱:Zettelkasten,代碼行數:14,代碼來源:NewEntryFrame.java

示例10: extraHighlightOff

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * Deaktiviert die Anzeige des Extra-Highlights
 * 
 * @author Christoph Lutz (D-III-ITD-5.1)
 */
private void extraHighlightOff()
{
  if (extraHighlightTag != null)
  {
    Highlighter hl = compo.getHighlighter();
    hl.removeHighlight(extraHighlightTag);
    extraHighlightTag = null;
  }
}
 
開發者ID:WollMux,項目名稱:WollMux,代碼行數:15,代碼來源:TextComponentTags.java

示例11: removeMarkers

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * Removes only our private highlights This is public so that we can remove
 * the highlights when the editorKit is unregistered. SimpleMarker can be
 * null, in which case all instances of our Markers are removed.
 *
 * @param component the text component whose markers are to be removed
 * @param marker the SimpleMarker to remove
 */
public static void removeMarkers(JTextComponent component, Highlighter.HighlightPainter marker) {
    Highlighter hilite = component.getHighlighter();
    Highlighter.Highlight[] hilites = hilite.getHighlights();

    for (int i = 0; i < hilites.length; i++) {
        Highlighter.HighlightPainter hMarker = hilites[i].getPainter();
        if (marker == null || hMarker.equals(marker)) {
            hilite.removeHighlight(hilites[i]);
        }
    }
}
 
開發者ID:jindrapetrik,項目名稱:jpexs-decompiler,代碼行數:20,代碼來源:MyMarkers.java

示例12: removeMarkers

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * Removes only our private highlights
 * This is public so that we can remove the highlights when the editorKit
 * is unregistered.  SimpleMarker can be null, in which case all instances of
 * our Markers are removed.
 * @param component the text component whose markers are to be removed
 * @param marker the SimpleMarker to remove
 */
public static void removeMarkers(JTextComponent component, SimpleMarker marker) {
    Highlighter hilite = component.getHighlighter();
    Highlighter.Highlight[] hilites = hilite.getHighlights();

    for (int i = 0; i < hilites.length; i++) {
        if (hilites[i].getPainter() instanceof SimpleMarker) {
            SimpleMarker hMarker = (SimpleMarker) hilites[i].getPainter();
            if (marker == null || hMarker.equals(marker)) {
                hilite.removeHighlight(hilites[i]);
            }
        }
    }
}
 
開發者ID:jindrapetrik,項目名稱:jpexs-decompiler,代碼行數:22,代碼來源:Markers.java

示例13: removeHighlight

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
static void removeHighlight(final JEditorPane editor) {
    Highlighter highlighter = editor.getHighlighter();
    Object tag = highlightTags.get(highlighter);
    if (tag != null) {
        highlighter.removeHighlight(tag);
        highlightTags.remove(highlighter);
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:9,代碼來源:HTMLEditorKit.java

示例14: removeHighlights

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * Remove all the Highlights from a JTextComponent
 *
 * @param component Instance of JTextComponent
 */
public void removeHighlights(JTextComponent component) {
    Highlighter hilite = component.getHighlighter();
    Highlighter.Highlight[] hilites = hilite.getHighlights();
    for (int i = 0; i < hilites.length; i++) {
        if (hilites[i].getPainter() instanceof HighlightBookmark) {
            hilite.removeHighlight(hilites[i]);
        }
    }
}
 
開發者ID:silverslade,項目名稱:jif,代碼行數:15,代碼來源:HighlightBookmark.java

示例15: removeHighlights

import javax.swing.text.Highlighter; //導入方法依賴的package包/類
/**
 * Remove all the Highlights from a JTextComponent
 *
 * @param component Instance of JTextComponent
 */
public void removeHighlights(JTextComponent component) {
    Highlighter hilite = component.getHighlighter();
    Highlighter.Highlight[] hilites = hilite.getHighlights();
    for (int i = 0; i < hilites.length; i++) {
        if (hilites[i].getPainter() instanceof HighlightText) {
            hilite.removeHighlight(hilites[i]);
        }
    }
}
 
開發者ID:silverslade,項目名稱:jif,代碼行數:15,代碼來源:HighlightText.java


注:本文中的javax.swing.text.Highlighter.removeHighlight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。