本文整理汇总了Java中javax.swing.text.SimpleAttributeSet.addAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleAttributeSet.addAttributes方法的具体用法?Java SimpleAttributeSet.addAttributes怎么用?Java SimpleAttributeSet.addAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.text.SimpleAttributeSet
的用法示例。
在下文中一共展示了SimpleAttributeSet.addAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttributes
import javax.swing.text.SimpleAttributeSet; //导入方法依赖的package包/类
public javax.swing.text.AttributeSet getAttributes()
{
SimpleAttributeSet attribs = new SimpleAttributeSet();
if (this.parent != null)
{
attribs.addAttributes(this.parent.getAttributes());
}
attribs.addAttributes(this.attribs);
return attribs;
}
示例2: processAnnotations
import javax.swing.text.SimpleAttributeSet; //导入方法依赖的package包/类
private List<AttributeSet> processAnnotations(Map<String, AttributeSet> annos, boolean isdefault) {
List<AttributeSet> annotations = new ArrayList<AttributeSet>();
for(Iterator it = AnnotationTypes.getTypes().getAnnotationTypeNames(); it.hasNext(); ) {
String name = (String) it.next ();
AnnotationType annotationType = AnnotationTypes.getTypes().getType(name);
if (!annotationType.isVisible()) {
continue;
}
String description = annotationType.getDescription();
if (description == null) {
continue;
}
SimpleAttributeSet category = new SimpleAttributeSet();
category.addAttribute(EditorStyleConstants.DisplayName, description);
category.addAttribute(StyleConstants.NameAttribute, annotationType.getName());
URL iconURL = annotationType.getGlyph ();
Image image = null;
if (iconURL.getProtocol ().equals ("nbresloc")) { // NOI18N
image = ImageUtilities.loadImage(iconURL.getPath().substring(1));
} else {
image = Toolkit.getDefaultToolkit ().getImage (iconURL);
}
if (image != null) {
category.addAttribute("icon", new ImageIcon(image)); //NOI18N
}
Color bgColor = annotationType.getHighlight();
if (annotationType.isUseHighlightColor() && bgColor != null) {
category.addAttribute(StyleConstants.Background, bgColor);
}
Color fgColor = annotationType.getForegroundColor();
if (!annotationType.isInheritForegroundColor() && fgColor != null) {
category.addAttribute(StyleConstants.Foreground, fgColor);
}
Color underColor = annotationType.getWaveUnderlineColor();
if (annotationType.isUseWaveUnderlineColor() && underColor != null) {
category.addAttribute(EditorStyleConstants.WaveUnderlineColor, underColor);
}
category.addAttribute("annotationType", annotationType); //NOI18N
if (annos.containsKey(name)) {
if (isdefault) {
category.removeAttribute(StyleConstants.Background);
category.removeAttribute(StyleConstants.Foreground);
category.removeAttribute(EditorStyleConstants.WaveUnderlineColor);
}
AttributeSet as = annos.get(name);
category.addAttributes(as);
}
annotations.add(category);
}
return annotations;
}