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


Java SimpleAttributeSet.addAttributes方法代碼示例

本文整理匯總了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;
}
 
開發者ID:andykuo1,項目名稱:candlelight,代碼行數:11,代碼來源:StyleBuilder.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:62,代碼來源:ColorModel.java


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