當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。