本文整理匯總了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);
}
}
}
}
示例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) {
}
}
示例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();
}
}
}
示例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();
}
示例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]);
}
}
}
示例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);
}
}
}
示例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();
}
示例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();
}
示例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);
}
}
}
示例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;
}
}
示例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]);
}
}
}
示例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]);
}
}
}
}
示例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);
}
}
示例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]);
}
}
}
示例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]);
}
}
}