当前位置: 首页>>代码示例>>Java>>正文


Java AttributedString.addAttributes方法代码示例

本文整理汇总了Java中java.text.AttributedString.addAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java AttributedString.addAttributes方法的具体用法?Java AttributedString.addAttributes怎么用?Java AttributedString.addAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.text.AttributedString的用法示例。


在下文中一共展示了AttributedString.addAttributes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTickLabel

import java.text.AttributedString; //导入方法依赖的package包/类
/**
 * Creates a tick label for the specified value based on the current
 * tick unit (used for formatting the exponent).
 *
 * @param value  the value.
 *
 * @return The label.
 *
 * @since 1.0.18
 */
protected AttributedString createTickLabel(double value) {
    if (this.numberFormatOverride != null) {
        return new AttributedString(
                this.numberFormatOverride.format(value));
    } else {
        String baseStr = this.baseSymbol;
        if (baseStr == null) {
            baseStr = this.baseFormatter.format(this.base);
        }
        double logy = calculateLog(value);
        String exponentStr = getTickUnit().valueToString(logy);
        AttributedString as = new AttributedString(baseStr + exponentStr);
        as.addAttributes(getTickLabelFont().getAttributes(), 0, (baseStr 
                + exponentStr).length());
        as.addAttribute(TextAttribute.SUPERSCRIPT, 
                TextAttribute.SUPERSCRIPT_SUPER, baseStr.length(), 
                baseStr.length() + exponentStr.length());
        return as;
    }
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:31,代码来源:LogAxis.java

示例2: newLine

import java.text.AttributedString; //导入方法依赖的package包/类
private void newLine() {

        String text = getCurrentLineText();
        AttributedString attrString = new AttributedString(text, STYLE_BASE);
        Iterator it = currentLineCache.iterator();
        int startCharIndex = 0;
        while (it.hasNext()) {
            LineCacheEntry entry = (LineCacheEntry)it.next();
            int endCharIndex = startCharIndex + entry.text.length();
            attrString.addAttributes(entry.attributes, startCharIndex, endCharIndex);
            startCharIndex = endCharIndex;
        }
        lines.add(attrString);
        textLines.add(text);
        
        if (lineHeight == 0) {
            TextLayout textLayout = new TextLayout(attrString.getIterator(), frc);
            lineHeight = (int)(textLayout.getAscent() + textLayout.getDescent() + textLayout.getLeading());
            ascent = (int)textLayout.getAscent();
            textLayout = new TextLayout("0", STYLE_BASE, frc);
            characterWidth = (int)textLayout.getAdvance();
        }
        currentHeight += lineHeight;
        currentWidth = Math.max(currentWidth, characterWidth * text.length());

        currentLineCache.clear();
    }
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:28,代码来源:ByteCodeDisplay.java

示例3: createAttributedLabel

import java.text.AttributedString; //导入方法依赖的package包/类
/**
 * Creates and returns an <code>AttributedString</code> with the specified
 * text and the labelFont and labelPaint applied as attributes.
 * 
 * @param label  the label ({@code null} permitted).
 * 
 * @return An attributed string or {@code null}.
 * 
 * @since 1.0.16
 */
public AttributedString createAttributedLabel(String label) {
    if (label == null) {
        return null;
    }
    AttributedString s = new AttributedString(label);
    s.addAttributes(this.labelFont.getAttributes(), 0, label.length());
    return s;
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:19,代码来源:Axis.java

示例4: createAttributedLabel

import java.text.AttributedString; //导入方法依赖的package包/类
/**
 * Creates and returns an {@code AttributedString} with the specified
 * text and the labelFont and labelPaint applied as attributes.
 * 
 * @param label  the label ({@code null} permitted).
 * 
 * @return An attributed string or {@code null}.
 * 
 * @since 1.0.16
 */
public AttributedString createAttributedLabel(String label) {
    if (label == null) {
        return null;
    }
    AttributedString s = new AttributedString(label);
    s.addAttributes(this.labelFont.getAttributes(), 0, label.length());
    return s;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:19,代码来源:Axis.java


注:本文中的java.text.AttributedString.addAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。