zoukankan      html  css  js  c++  java
  • e655. 混合风格的文本

    This example applies a new font and background color to a part of the text. You can apply styles to as many parts of the text as you need. See TextAttributes for available styles.

        // Apply styles to text
        AttributedString astr = new AttributedString("aString");
        astr.addAttribute(TextAttribute.FONT, font, start, end);
        astr.addAttribute(TextAttribute.BACKGROUND, color, start, end);
        
        // Draw mixed-style text
        TextLayout tl = new TextLayout(astr.getIterator(), g2d.getFontRenderContext());
        tl.draw(g2d, x, y);
    
    Related Examples
  • 相关阅读:
    星空雅梦
    星空雅梦
    星空雅梦
    星空雅梦
    星空雅梦
    星空雅梦
    星空雅梦
    星空雅梦
    星空雅梦
    PHP中foreach用法详细讲解
  • 原文地址:https://www.cnblogs.com/borter/p/9575451.html
Copyright © 2011-2022 走看看