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


Java SimpleAttributeSet.removeAttribute方法代碼示例

本文整理匯總了Java中javax.swing.text.SimpleAttributeSet.removeAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleAttributeSet.removeAttribute方法的具體用法?Java SimpleAttributeSet.removeAttribute怎麽用?Java SimpleAttributeSet.removeAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.text.SimpleAttributeSet的用法示例。


在下文中一共展示了SimpleAttributeSet.removeAttribute方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setViewData

import javax.swing.text.SimpleAttributeSet; //導入方法依賴的package包/類
/**
    * Sets data optained from the View
    */
   public void setViewData(View v) {
myView = v;
doc = (HTMLDocument) myView.getDocument();
base = doc.getBase();

// Set the current font information in the local text attributes
Font font = getFont();
textAttribs = new SimpleAttributeSet();
textAttribs.removeAttribute(StyleConstants.FontSize);
textAttribs.removeAttribute(StyleConstants.Bold);
textAttribs.removeAttribute(StyleConstants.Italic);
textAttribs.addAttribute(StyleConstants.FontFamily,
			 font.getName());
textAttribs.addAttribute(StyleConstants.FontSize,
			 new Integer(font.getSize()));
textAttribs.addAttribute(StyleConstants.Bold,
			 Boolean.valueOf(font.isBold()));
textAttribs.addAttribute(StyleConstants.Italic,
			 Boolean.valueOf(font.isItalic()));
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:BrowserDisplayer.java

示例2: updateData

import javax.swing.text.SimpleAttributeSet; //導入方法依賴的package包/類
private void updateData () {
    int index = lCategories.getSelectedIndex();
    if (index < 0) return;
    
    List<AttributeSet> categories = getCategories();
    AttributeSet category = categories.get(lCategories.getSelectedIndex());
    SimpleAttributeSet c = new SimpleAttributeSet(category);
    
    Color color = cbBackground.getSelectedColor();
    if (color != null) {
        c.addAttribute(StyleConstants.Background, color);
    } else {
        c.removeAttribute(StyleConstants.Background);
    }
    
    categories.set(index, c);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:DiffColorsPanel.java

示例3: setColor

import javax.swing.text.SimpleAttributeSet; //導入方法依賴的package包/類
public void setColor(int index, Color color) {
    if (color == null) return;
    AttributeSet attr = colorAttributes.get(index);
    SimpleAttributeSet c = new SimpleAttributeSet(attr);
    if (attr != null) {
        c.addAttribute(StyleConstants.Background, color);
    } else {
        c.removeAttribute(StyleConstants.Background);
    }
    colorAttributes.set(index, c);
    Color[] savedColor = colors.get((String)c.getAttribute(StyleConstants.NameAttribute));
    savedColor[0] = color;
    fireChanged();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:AnnotationColorsPanel.java

示例4: updateData

import javax.swing.text.SimpleAttributeSet; //導入方法依賴的package包/類
private void updateData () {
    List<AttributeSet> annotations = getAnnotations(currentScheme);
    int index = lCategories.getSelectedIndex();
    SimpleAttributeSet c = new SimpleAttributeSet(annotations.get(index));
    
    Color color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbBackground );
    if (color != null) {
        c.addAttribute(StyleConstants.Background, color);
    } else {
        c.removeAttribute(StyleConstants.Background);
    }
    
    color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbForeground );
    if (color != null) {
        c.addAttribute(StyleConstants.Foreground, color);
    } else {
        c.removeAttribute(StyleConstants.Foreground);
    }
    
    Color wave = null;
    if (cbEffects.getSelectedIndex () == 1)
         wave = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbEffectColor );
    if (wave != null) {
        c.addAttribute(EditorStyleConstants.WaveUnderlineColor, wave);
    } else {
        c.removeAttribute(EditorStyleConstants.WaveUnderlineColor);
    }
    
    annotations.set(index, c);
    
    toBeSaved.add(currentScheme);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:AnnotationsPanel.java

示例5: updateData

import javax.swing.text.SimpleAttributeSet; //導入方法依賴的package包/類
/**
 * Called on user change.
 * Updates data structures and preview panel.
 */
private void updateData () {
    int i = lCategories.getSelectedIndex ();
    if (i < 0) return;
    
    AttributeSet category = getCurrentCategory ();
    Color underline = null, 
          wave = null, 
          strikethrough = null;
    if (cbEffects.getSelectedIndex () == 1)
        underline = ((ColorComboBox)cbEffectColor).getSelectedColor();
    if (cbEffects.getSelectedIndex () == 2)
        wave = ((ColorComboBox)cbEffectColor).getSelectedColor();
    if (cbEffects.getSelectedIndex () == 3)
        strikethrough = ((ColorComboBox)cbEffectColor).getSelectedColor();
    
    SimpleAttributeSet c = category != null ? new SimpleAttributeSet(category) : new SimpleAttributeSet();
    
    Color color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbBackground );
    if (color != null) {
        c.addAttribute(StyleConstants.Background, color);
    } else {
        c.removeAttribute(StyleConstants.Background);
    }
    
    color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbForeground );
    if (color != null) {
        c.addAttribute(StyleConstants.Foreground, color);
    } else {
        c.removeAttribute(StyleConstants.Foreground);
    }
    
    if (underline != null) {
        c.addAttribute(StyleConstants.Underline, underline);
    } else {
        c.removeAttribute(StyleConstants.Underline);
    }
    
    if (strikethrough != null) {
        c.addAttribute(StyleConstants.StrikeThrough, strikethrough);
    } else {
        c.removeAttribute(StyleConstants.StrikeThrough);
    }
    
    if (wave != null) {
        c.addAttribute(EditorStyleConstants.WaveUnderlineColor, wave);
    } else {
        c.removeAttribute(EditorStyleConstants.WaveUnderlineColor);
    }
    
    replaceCurrrentCategory(c);
    setToBeSaved(currentProfile, currentLanguage);
    updatePreview();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:58,代碼來源:SyntaxColoringPanel.java

示例6: modifyFont

import javax.swing.text.SimpleAttributeSet; //導入方法依賴的package包/類
private AttributeSet modifyFont (AttributeSet category, Font f) {
    String fontName = f.getName ();
    Integer fontSize = new Integer (f.getSize ());
    Boolean bold = Boolean.valueOf (f.isBold ());
    Boolean italic = Boolean.valueOf (f.isItalic ());
    boolean isDefault = "default".equals (
        category.getAttribute (StyleConstants.NameAttribute)
    );
    if (fontName.equals (
        getDefault (currentLanguage, category, StyleConstants.FontFamily)
    ) && !isDefault)
        fontName = null;
    if (fontSize.equals (
        getDefault (currentLanguage, category, StyleConstants.FontSize)
    ) && !isDefault)
        fontSize = null;
    if (bold.equals (getDefault (currentLanguage, category, StyleConstants.Bold))
    )
        bold = null;
    else
    if (bold.equals (Boolean.FALSE) &&
        getDefault (currentLanguage, category, StyleConstants.Bold) == null
    )
        bold = null;
    if (italic.equals (getDefault (currentLanguage, category, StyleConstants.Italic))
    )
        italic = null;
    else
    if (italic.equals (Boolean.FALSE) &&
        getDefault (currentLanguage, category, StyleConstants.Italic) == null
    )
        italic = null;
    SimpleAttributeSet c = new SimpleAttributeSet (category);
    if (fontName != null)
        c.addAttribute (
            StyleConstants.FontFamily,
            fontName
        );
    else
        c.removeAttribute (StyleConstants.FontFamily);
    if (fontSize != null)
        c.addAttribute (
            StyleConstants.FontSize,
            fontSize
        );
    else
        c.removeAttribute (StyleConstants.FontSize);
    if (bold != null)
        c.addAttribute (
            StyleConstants.Bold,
            bold
        );
    else
        c.removeAttribute (StyleConstants.Bold);
    if (italic != null)
        c.addAttribute (
            StyleConstants.Italic,
            italic
        );
    else
        c.removeAttribute (StyleConstants.Italic);
    
    return c;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:65,代碼來源:SyntaxColoringPanel.java

示例7: 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

示例8: updateData

import javax.swing.text.SimpleAttributeSet; //導入方法依賴的package包/類
private void updateData () {
    int index = lCategories.getSelectedIndex();
    if (index < 0) return;
    
    List<AttributeSet> categories = getCategories(currentProfile);
    AttributeSet category = categories.get(lCategories.getSelectedIndex());
    SimpleAttributeSet c = new SimpleAttributeSet(category);
    
    Color color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbBackground );
    if (color != null) {
        c.addAttribute(StyleConstants.Background, color);
    } else {
        c.removeAttribute(StyleConstants.Background);
    }
    
    color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbForeground );
    if (color != null) {
        c.addAttribute(StyleConstants.Foreground, color);
    } else {
        c.removeAttribute(StyleConstants.Foreground);
    }

    Color underline = null,
          wave = null,
          strikethrough = null;
    if (cbEffects.getSelectedIndex () == 1)
        underline = ((ColorComboBox)cbEffectColor).getSelectedColor();
    if (cbEffects.getSelectedIndex () == 2)
        wave = ((ColorComboBox)cbEffectColor).getSelectedColor();
    if (cbEffects.getSelectedIndex () == 3)
        strikethrough = ((ColorComboBox)cbEffectColor).getSelectedColor();

    if (underline != null) {
        c.addAttribute(StyleConstants.Underline, underline);
    } else {
        c.removeAttribute(StyleConstants.Underline);
    }

    if (strikethrough != null) {
        c.addAttribute(StyleConstants.StrikeThrough, strikethrough);
    } else {
        c.removeAttribute(StyleConstants.StrikeThrough);
    }

    if (wave != null) {
        c.addAttribute(EditorStyleConstants.WaveUnderlineColor, wave);
    } else {
        c.removeAttribute(EditorStyleConstants.WaveUnderlineColor);
    }
    
    categories.set(index, c);
    toBeSaved.add(currentProfile);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:54,代碼來源:HighlightingPanel.java


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