private void insertAttr(SimpleAttributeSet attrs, Object key, Object value) { while(attrs.isDefined(key)) { attrs.removeAttribute(key); } attrs.addAttribute(key, value); } }
return; textAttribs.removeAttribute(Foreground); textAttribs.addAttribute(Foreground, color); setForeground(color);
public void setViewData(View v) { doc = (HTMLDocument) v.getDocument(); textAttribs = new SimpleAttributeSet(); textAttribs.removeAttribute(FontSize); textAttribs.removeAttribute(Bold); textAttribs.removeAttribute(Italic); Font font = getFont(); textAttribs.addAttribute(FontFamily, font.getName()); textAttribs.addAttribute(FontSize, font.getSize()); textAttribs.addAttribute(Bold, font.isBold()); textAttribs.addAttribute(Italic, font.isItalic()); }
return; textAttribs.removeAttribute(StyleConstants.Foreground); textAttribs.addAttribute(StyleConstants.Foreground, color); setForeground(color);
public void setTextFontWeight(String weight) { boolean isBold = "bold".equals(weight); textAttribs.removeAttribute(Bold); textAttribs.addAttribute(Bold, isBold); setFont(getAttributeSetFont(textAttribs)); Font font = getFont(); }
public void setTextFontStyle(String style) { boolean isItalic = "italic".equals(style); textAttribs.removeAttribute(Italic); textAttribs.addAttribute(Italic, isItalic); setFont(getAttributeSetFont(textAttribs)); Font font = getFont(); }
/** * Sets the text Font Style for the activator text. * Valid font styles are * <ul> * <li>plain * <li>italic * </ul> */ public void setTextFontStyle(String style) { boolean isItalic=false; if (style.compareTo("italic") == 0) { isItalic = true; } else { isItalic = false; } textAttribs.removeAttribute(StyleConstants.Italic); textAttribs.addAttribute(StyleConstants.Italic, new Boolean(isItalic)); setFont(getAttributeSetFont(textAttribs)); Font font = getFont(); }
/** * Sets the text Font Weigth for the activator text. * Valid weights are * <ul> * <li>plain * <li>bold * </ul> */ public void setTextFontWeight(String weight) { boolean isBold=false; if (weight.compareTo("bold") == 0) { isBold = true; } else { isBold = false; } textAttribs.removeAttribute(StyleConstants.Bold); textAttribs.addAttribute(StyleConstants.Bold, new Boolean(isBold)); setFont(getAttributeSetFont(textAttribs)); Font font = getFont(); }
/** * Sets the text Font family for the activator text. * For JDK 1.1 this must a family name of Dialog, DialogInput, Monospaced, * Serif, SansSerif, or Symbol. */ public void setTextFontFamily(String family) { textAttribs.removeAttribute(StyleConstants.FontFamily); textAttribs.addAttribute(StyleConstants.FontFamily, family); setFont(getAttributeSetFont(textAttribs)); Font font = getFont(); }
public void setTextFontFamily(String family) { textAttribs.removeAttribute(FontFamily); textAttribs.addAttribute(FontFamily, family); setFont(getAttributeSetFont(textAttribs)); Font font = getFont(); }
textAttribs.removeAttribute(StyleConstants.FontSize); textAttribs.removeAttribute(StyleConstants.Bold); textAttribs.removeAttribute(StyleConstants.Italic); textAttribs.addAttribute(StyleConstants.FontFamily, font.getName());
return; textAttribs.removeAttribute(FontSize); textAttribs.addAttribute(FontSize, newsize); setFont(getAttributeSetFont(textAttribs));
return; textAttribs.removeAttribute(StyleConstants.FontSize); textAttribs.addAttribute(StyleConstants.FontSize, new Integer(newsize));
} else { sasText.removeAttribute(HTML.Tag.P); SimpleAttributeSet attribs = new SimpleAttributeSet(); attribs.addAttribute(HTML.Attribute.ALIGN, a_);