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

x33g5p2x  于2022-01-30 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(74)

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

SimpleAttributeSet.isDefined介绍

暂无

代码示例

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

private void insertAttr(SimpleAttributeSet attrs, Object key, Object value)
  {
    while(attrs.isDefined(key))
    {
      attrs.removeAttribute(key);
    }
    attrs.addAttribute(key, value);
  }
}

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

public class ExtendedHTMLEditorKit extends HTMLEditorKit{
//.... other code here
  public class MyHTMLFactory extends HTMLFactory{
   //other code here
   @Override
   public View create(Element elem) {
     if (isLayered(elem)){ //it means, it has position attribute
       return new PositionedView(elem);
     }
     else 
      return super.create(elem);
   }

   boolean isLayered(Element elem){
     SimpleAttributeSet sas = new  SimpleAttributeSet(elem);
     StyleSheet styles = (HTMLDocument elem.getDocument).getStyleSheet();
     Tag tag = element.getAttributes().getAttribute(AttributeSet.NameAttribute);
     sas.addAttributes(styleSheet.getRule(tag, element));
     return sas.isDefined("position") 
      && !sas.getAttribute("position").toString().equalsIgnorecase("static");
   }
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-languages

private static void addColor(
    String tokenType,
    SimpleAttributeSet sas,
    Map<String,AttributeSet> colorsMap,
    Map<String,AttributeSet> defaultsMap
    ) {
  if (sas == null)
    sas = new SimpleAttributeSet();
  else
    sas = new SimpleAttributeSet(sas);
  String colorName = (String) sas.getAttribute(StyleConstants.NameAttribute);
  if (colorName == null)
    colorName = tokenType;
  sas.addAttribute(StyleConstants.NameAttribute, colorName);
  sas.addAttribute(EditorStyleConstants.DisplayName, colorName);
  if (!sas.isDefined(EditorStyleConstants.Default)) {
    String def = colorName;
    int i = def.lastIndexOf('_');
    if (i > 0) def = def.substring(i + 1);
    if (defaultsMap.containsKey(def))
      sas.addAttribute(EditorStyleConstants.Default, def);
  }
  colorsMap.put(colorName, sas);
}

代码示例来源:origin: net.sf.mmax2/mmax2

if (resultSet.isDefined(StyleConstants.Foreground)) StyleConstants.setForeground(resultSet,Color.black);
if (resultSet.isDefined(StyleConstants.Background)) StyleConstants.setBackground(resultSet,Color.white);

代码示例来源:origin: net.sf.mmax2/mmax2

if (result.isDefined(StyleConstants.Foreground)==false)
if (result.isDefined(StyleConstants.Background)==false)
if (result.isDefined(StyleConstants.FontSize)==false)
if (result.isDefined(StyleConstants.FontFamily)==false)

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

if(attrs.isDefined("face"))

代码示例来源:origin: javax.help/javahelp

/**
 * Creates a link button. This is just a JButton with default settings.
 */
private void createLinkButton() {
LookAndFeel.installBorder(this, buttonPropertyPrefix + "border");
setBorderPainted(true);
setFocusPainted(true);
setAlignmentY(Container.CENTER_ALIGNMENT);
setContentAreaFilled(true);
setBackground(UIManager.getColor(buttonPropertyPrefix + "background"));
if (textAttribs != null && 
  textAttribs.isDefined(StyleConstants.Foreground)) {
  setForeground((Color)textAttribs.getAttribute(StyleConstants.Foreground));
} else {
  setForeground(UIManager.getColor(buttonPropertyPrefix + "foreground"));
}
invalidate();
}

代码示例来源:origin: javax.help/javahelp

/**
 * Creates a link label. A link label is a form of a JButton but without a
 * button like appearance.
 */
private void createLinkLabel() {
setBorder(new EmptyBorder(1,1,1,1));
setBorderPainted(false);
setFocusPainted(false);
setAlignmentY(getPreferredLabelAlignment());
setContentAreaFilled(false);
setBackground(UIManager.getColor(editorPropertyPrefix + "background"));
if (textAttribs != null &&
  textAttribs.isDefined(StyleConstants.Foreground)) {
  setForeground((Color)textAttribs.getAttribute(StyleConstants.Foreground));
} else {
  setForeground(Color.blue);
}
invalidate();
}

代码示例来源:origin: cpesch/RouteConverter

private void createLinkLabel() {
  setBorder(new EmptyBorder(1, 1, 1, 1));
  setBorderPainted(false);
  setFocusPainted(false);
  setAlignmentY(getPreferredAlignmentY());
  setContentAreaFilled(false);
  setHorizontalAlignment(LEFT);
  setBackground(UIManager.getColor("EditorPane.background"));
  if (textAttribs != null && textAttribs.isDefined(Foreground)) {
    setForeground((Color) textAttribs.getAttribute(Foreground));
  } else {
    setForeground(blue);
  }
  invalidate();
}

代码示例来源:origin: net.sf.mmax2/mmax2

if (superiorSet.isDefined("handles")==false)
  if (inferiorSet.isDefined("handles"))
if (superiorSet.isDefined(StyleConstants.Foreground))
else if (inferiorSet.isDefined(StyleConstants.Foreground))
if (superiorSet.isDefined(StyleConstants.Background))
else if (inferiorSet.isDefined(StyleConstants.Background))
if (inferiorSet.isDefined(StyleConstants.FontSize))
  if (superiorSet.isDefined(StyleConstants.FontSize)==false)

代码示例来源:origin: net.sf.mmax2/mmax2

if (styleToUse.isDefined(StyleConstants.FontSize)==false)
if (styleToUse.isDefined(StyleConstants.FontFamily)==false)
if (styleToUse.isDefined(StyleConstants.FontSize)==false)
if (styleToUse.isDefined(StyleConstants.FontFamily)==false)
    if (markableAttributes.isDefined("handles"))
    if (markableAttributes.isDefined(StyleConstants.FontSize))
    if (markableAttributes.isDefined(StyleConstants.FontFamily))
if (styleToUse.isDefined(StyleConstants.FontSize)==false)

相关文章