javax.swing.text.MutableAttributeSet.removeAttribute()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中javax.swing.text.MutableAttributeSet.removeAttribute()方法的一些代码示例,展示了MutableAttributeSet.removeAttribute()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MutableAttributeSet.removeAttribute()方法的具体详情如下:
包路径:javax.swing.text.MutableAttributeSet
类名称:MutableAttributeSet
方法名:removeAttribute

MutableAttributeSet.removeAttribute介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

pane.addCaretListener(new CaretListener() {
  public void caretUpdate(CaretEvent event) {
    final JTextPane textPane = (JTextPane) event.getSource();
    EventQueue.invokeLater(new Runnable() {
      public void run() {
        MutableAttributeSet inputAttr =
          textPane.getInputAttributes();
        inputAttr.removeAttribute(StyleConstants.Foreground);
      }
    });
  }
});

代码示例来源:origin: stackoverflow.com

private void blockURLTyping(MutableAttributeSet inputAttr, int dot, int mark)
{
  StyledDocument doc = getStyledDocument();
  int begin = (dot < mark) ? dot - 1 : mark - 1;
  if(begin >= 0)
  {
    Element dotEl = doc.getCharacterElement(begin);
    Element markEl = doc.getCharacterElement((dot < mark) ? mark : dot);
    AttributeSet dotAttr = dotEl.getAttributes();
    AttributeSet markAttr = markEl.getAttributes();
    if(dotAttr.isDefined(HTML.Attribute.HREF)) // Ensure atleast one of them isn't null
    {
      if(dotAttr.getAttribute(HTML.Attribute.HREF) == markAttr.getAttribute(HTML.Attribute.HREF))
      {
        inputAttr.addAttribute(HTML.Attribute.HREF, dotAttr.getAttribute(HTML.Attribute.HREF));
        inputAttr.addAttribute(StyleConstants.Foreground, Color.BLUE);
        inputAttr.addAttribute(StyleConstants.Underline, true);
        return;
      }
    }
  }
  if(inputAttr.isDefined(HTML.Attribute.HREF)) // In all other cases => remove
  {
    inputAttr.removeAttribute(HTML.Attribute.HREF);
    inputAttr.removeAttribute(StyleConstants.Foreground);
    inputAttr.removeAttribute(StyleConstants.Underline);
  }
}

代码示例来源:origin: org.apache.maven.doxia/doxia-module-twiki

/** {@inheritDoc} */
public void verbatim( SinkEventAttributes attributes )
{
  MutableAttributeSet atts = SinkUtils.filterAttributes( attributes, SinkUtils.SINK_VERBATIM_ATTRIBUTES );
  if ( atts == null )
  {
    atts = new SinkEventAttributeSet();
  }
  boolean boxed = false;
  if ( atts.isDefined( SinkEventAttributes.DECORATION ) )
  {
    boxed = "boxed".equals( atts.getAttribute( SinkEventAttributes.DECORATION ).toString() );
  }
  if ( boxed )
  {
    atts.addAttribute( Attribute.CLASS, "source" );
  }
  atts.removeAttribute( SinkEventAttributes.DECORATION );
  String width = (String) atts.getAttribute( Attribute.WIDTH.toString() );
  atts.removeAttribute( Attribute.WIDTH.toString() );
  writeStartTag( Tag.DIV, atts );
  writeEOL( true );
  if ( width != null )
  {
    atts.addAttribute( Attribute.WIDTH.toString(), width );
  }
  atts.removeAttribute( Attribute.ALIGN.toString() );
  atts.removeAttribute( Attribute.CLASS.toString() );
  writeStartTag( VERBATIM_TAG, atts );
}

代码示例来源:origin: org.apache.maven.doxia/doxia-module-xdoc

atts.removeAttribute( SinkEventAttributes.DECORATION );
  atts.removeAttribute( Attribute.ALIGN.toString() );
  writeStartTag( PRE, atts );

代码示例来源:origin: org.apache.maven.doxia/doxia-module-fo

/**
 * Writes a start tag, prepending EOL.
 *
 * @param tag The tag.
 * @param id An id to add.
 * @param name The name (value) of the id.
 * @param attributeId An id identifying the attribute set.
 */
protected void writeStartTag( Tag tag, String id, String name, String attributeId )
{
  MutableAttributeSet att = config.getAttributeSet( attributeId );
  // make sure we don't add it twice
  if ( att.isDefined( id ) )
  {
    att.removeAttribute( id );
  }
  att.addAttribute( id, name );
  writeEOL();
  writeStartTag( tag, att );
}

代码示例来源:origin: org.piccolo2d/piccolo2d-core

clientProperties.removeAttribute(key);

代码示例来源:origin: org.eclipse.scout.rt/org.eclipse.scout.commons

element.removeAttribute(a.getKey());

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

value = attr.getAttribute(aName);
if (value != null && !value.toString().equalsIgnoreCase(tag.toString())) {
 attr.removeAttribute(aName);

相关文章