本文整理匯總了Java中javax.swing.text.AttributeSet.getAttributeCount方法的典型用法代碼示例。如果您正苦於以下問題:Java AttributeSet.getAttributeCount方法的具體用法?Java AttributeSet.getAttributeCount怎麽用?Java AttributeSet.getAttributeCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.text.AttributeSet
的用法示例。
在下文中一共展示了AttributeSet.getAttributeCount方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toAttrSetBuilder
import javax.swing.text.AttributeSet; //導入方法依賴的package包/類
static AttrSetBuilder toAttrSetBuilder(AttributeSet attrs) {
AttrSetBuilder builder = new AttrSetBuilder(attrs.getAttributeCount() << 1);
Enumeration<?> en = attrs.getAttributeNames();
while (en.hasMoreElements()) {
Object key = en.nextElement();
Object value = attrs.getAttribute(key);
builder.add(key, value);
}
return builder;
}
示例2: translate
import javax.swing.text.AttributeSet; //導入方法依賴的package包/類
public static Map<Attribute,Object> translate(AttributeSet attrs) {
int attrCount = attrs.getAttributeCount();
Map<Attribute,Object> ret = new HashMap<Attribute, Object>(attrCount);
for (Enumeration<?> attrNames = attrs.getAttributeNames(); attrNames.hasMoreElements();) {
Object attrName = attrNames.nextElement();
AttributeTranslateHandler handler = attr2Handler.get(attrName);
if (handler != null) {
Object textAttrValue = handler.getTextAttrValue(attrs.getAttribute(attrName));
if (textAttrValue != null) {
ret.put(handler.getTextAttr(), textAttrValue);
}
} // Unknown attributes are ignored
}
return ret;
}
示例3: isEqual
import javax.swing.text.AttributeSet; //導入方法依賴的package包/類
public boolean isEqual(AttributeSet attr) {
if(getAttributeCount() != attr.getAttributeCount()) return false;
return containsAttributes(attr);
}
示例4: isEqual
import javax.swing.text.AttributeSet; //導入方法依賴的package包/類
public boolean isEqual(AttributeSet attr) {
return (attr.getAttributeCount() == 1)
&& NAME.equals(attr.getAttribute(NameAttribute));
}
示例5: containsAttributes
import javax.swing.text.AttributeSet; //導入方法依賴的package包/類
public boolean containsAttributes(AttributeSet attributes) {
int attrCount = attributes.getAttributeCount();
return (attrCount == 0)
|| (attrCount == 1)
&& (NAME.equals(attributes.getAttribute(NameAttribute)));
}