Search code examples
java-melwuitnokia-s40

How to reduce the Font of a text in LWUIT TextArea


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?


Solution

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