本文整理匯總了Java中javax.swing.text.AttributeSet.containsAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java AttributeSet.containsAttribute方法的具體用法?Java AttributeSet.containsAttribute怎麽用?Java AttributeSet.containsAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.text.AttributeSet
的用法示例。
在下文中一共展示了AttributeSet.containsAttribute方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findNextUnused
import javax.swing.text.AttributeSet; //導入方法依賴的package包/類
private int findNextUnused(JTextComponent comp, int offset) {
try {
BaseDocument doc = Utilities.getDocument(comp);
int lineStart = Utilities.getRowStart(doc, offset);
// "unused-browseable" in java.editor/.../ColoringManager and csl.api/.../ColoringManager
HighlightsSequence s = HighlightingManager.getInstance(comp).getBottomHighlights().getHighlights(lineStart, Integer.MAX_VALUE);
int lastUnusedEndOffset = -1;
while (s.moveNext()) {
AttributeSet attrs = s.getAttributes();
if (attrs != null && attrs.containsAttribute("unused-browseable", Boolean.TRUE)) {
if (lastUnusedEndOffset != s.getStartOffset() && s.getStartOffset() >= offset) {
return s.getStartOffset();
}
lastUnusedEndOffset = s.getEndOffset();
}
}
return -1;
} catch (BadLocationException ex) {
Exceptions.printStackTrace(ex);
return -1;
}
}
示例2: Highlighting
import javax.swing.text.AttributeSet; //導入方法依賴的package包/類
/** Creates a new instance of Highlighting */
public Highlighting(Document doc) {
AttributeSet firstLineFontColor = MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(FontColorSettings.class).getTokenFontColors("javadoc-first-sentence"); //NOI18N
AttributeSet commentFontColor = MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(FontColorSettings.class).getTokenFontColors("comment"); //NOI18N
if(firstLineFontColor != null && commentFontColor != null) {
Collection<Object> attrs = new LinkedList<Object>();
for (Enumeration<?> e = firstLineFontColor.getAttributeNames(); e.hasMoreElements(); ) {
Object key = e.nextElement();
Object value = firstLineFontColor.getAttribute(key);
if (!commentFontColor.containsAttribute(key, value)) {
attrs.add(key);
attrs.add(value);
}
}
fontColor = AttributesUtilities.createImmutable(attrs.toArray());
} else {
fontColor = AttributesUtilities.createImmutable();
LOG.warning("FontColorSettings for javadoc-first-sentence or comment are not available."); //NOI18N
}
this.document = doc;
hierarchy = TokenHierarchy.get(document);
if (hierarchy != null) {
hierarchy.addTokenHierarchyListener(WeakListeners.create(TokenHierarchyListener.class, this, hierarchy));
}
}
示例3: containsAttribute
import javax.swing.text.AttributeSet; //導入方法依賴的package包/類
public boolean containsAttribute(Object key, Object value) {
for(AttributeSet delegate : delegates) {
if (delegate.containsAttribute(key, value)) {
return true;
}
}
return false;
}