【问题标题】:How to reduce the Font of a text in LWUIT TextArea如何减少 LWUIT TextArea 中文本的字体
【发布时间】:2012-08-09 06:03:49
【问题描述】:

我已经创建了 LWUIT TextArea,并在我的 TextArea 中添加了文本段落,现在我想减小我的 TextArea 的字体大小,我使用了以下代码:

TextArea big = new TextArea(detailNews.getDescription());
Font createSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC, Font.SIZE_SMALL);
    big.getStyle().setFont(createSystemFont);
    big.setEditable(false);                    
    form2.addComponent(big);
    form2.show();

但是,为什么我不能减小文本的字体?

【问题讨论】:

    标签: java-me lwuit nokia-s40


    【解决方案1】:

    在资源编辑器中创建字体。然后,从应用程序的资源文件中导入字体。通过使用此方法,您可以将任何字体应用到系统中安装的应用程序。您还可以为字体设置任何字体大小。

    浏览链接以了解如何在资源编辑器中创建字体。

    http://docs.oracle.com/javame/dev-tools/lwuit-1.4/LWUIT_Developer_Guide_HTML/cjbcgcdd.html#z400088e1296018

    【讨论】:

      【解决方案2】:

      用途:

      TextArea big = new TextArea(detailNews.getDescription());
      
      Font createSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_ITALIC,Font.SIZE_SMALL);
      
      big.getUnselectedStyle().setFont(createSystemFont); 
      big.getSelectedStyle().setFont(createSystemFont); 
      
      // Added TextArea object big to the Form object form.
      form.addComponent(big);
      form.show();
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-01-30
        • 1970-01-01
        • 1970-01-01
        • 2011-06-18
        • 2020-10-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多