本文整理匯總了Java中javax.swing.text.MutableAttributeSet.removeAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java MutableAttributeSet.removeAttribute方法的具體用法?Java MutableAttributeSet.removeAttribute怎麽用?Java MutableAttributeSet.removeAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.text.MutableAttributeSet
的用法示例。
在下文中一共展示了MutableAttributeSet.removeAttribute方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateFrame
import javax.swing.text.MutableAttributeSet; //導入方法依賴的package包/類
/**
* Updates the frame that is represented by the specified element to
* refer to the specified URL.
*
* @param el the element
* @param url the new url
*/
private void updateFrame(Element el, URL url)
{
try
{
writeLock();
DefaultDocumentEvent ev =
new DefaultDocumentEvent(el.getStartOffset(), 1,
DocumentEvent.EventType.CHANGE);
AttributeSet elAtts = el.getAttributes();
AttributeSet copy = elAtts.copyAttributes();
MutableAttributeSet matts = (MutableAttributeSet) elAtts;
ev.addEdit(new AttributeUndoableEdit(el, copy, false));
matts.removeAttribute(HTML.Attribute.SRC);
matts.addAttribute(HTML.Attribute.SRC, url.toString());
ev.end();
fireChangedUpdate(ev);
fireUndoableEditUpdate(new UndoableEditEvent(this, ev));
}
finally
{
writeUnlock();
}
}
示例2: set
import javax.swing.text.MutableAttributeSet; //導入方法依賴的package包/類
public boolean set(MutableAttributeSet target)
{
if (swingValue == null)
target.removeAttribute(swingName);
else
target.addAttribute(swingName, swingValue);
return true;
}
示例3: updateSpecialClass
import javax.swing.text.MutableAttributeSet; //導入方法依賴的package包/類
/**
* Updates the A tag's pseudo class value in response to a hyperlink
* action.
*
* @param el the corresponding element
* @param value the new value
*/
void updateSpecialClass(Element el, HTML.Attribute cl, String value)
{
try
{
writeLock();
DefaultDocumentEvent ev =
new DefaultDocumentEvent(el.getStartOffset(), 1,
DocumentEvent.EventType.CHANGE);
AttributeSet elAtts = el.getAttributes();
AttributeSet anchorAtts = (AttributeSet) elAtts.getAttribute(HTML.Tag.A);
if (anchorAtts != null)
{
AttributeSet copy = elAtts.copyAttributes();
StyleSheet ss = getStyleSheet();
if (value != null)
{
anchorAtts = ss.addAttribute(anchorAtts, cl, value);
}
else
{
anchorAtts = ss.removeAttribute(anchorAtts, cl);
}
MutableAttributeSet matts = (MutableAttributeSet) elAtts;
ev.addEdit(new AttributeUndoableEdit(el, copy, false));
matts.removeAttribute(HTML.Tag.A);
matts.addAttribute(HTML.Tag.A, anchorAtts);
ev.end();
fireChangedUpdate(ev);
fireUndoableEditUpdate(new UndoableEditEvent(this, ev));
}
}
finally
{
writeUnlock();
}
}
示例4: setDefault
import javax.swing.text.MutableAttributeSet; //導入方法依賴的package包/類
public boolean setDefault(MutableAttributeSet target)
{
target.removeAttribute(swingName);
return true;
}