Frage

I have created LWUIT TextArea,and I have added paragraphs of text to my TextArea ,now i want to reduce my TextArea's font size,I have used the code below:

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();

But, why I am not able to reduce the font of my text?

War es hilfreich?

Lösung 2

Use:

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();

Andere Tipps

Create font in Resource editor. Then, import the font from resource file in your app. By using this method, you can apply any font to your app that is installed in your system. You can also set any font size to the font.

Explore the link to know how to create font in resource editor.

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top