0

I have created LWUIT TextField,and I've added paragraphs of text to my TextField,But I am not able to Display the Fulltext ?I am able to Display single line of text? Here my Code:

   TextField field=new TextField(detailNews.getDescription());             
   field.setSingleLineTextArea(false);        
   field.setGrowByContent(true);       
   field.setIsScrollVisible(true);
   field.setFocus(false);
   field.setRows(detailNews.getDescription().length());     
   form2.addComponent(field);
Mun0n
  • 4,438
  • 4
  • 28
  • 46
String
  • 3,660
  • 10
  • 43
  • 66

1 Answers1

2

TextFieldis only for a single line case. What you want to use is a TextAreaComponent. So try to change your TextFieldcomponent by a TextArea Component

Mun0n
  • 4,438
  • 4
  • 28
  • 46
  • hi,i have used TextArea,but i am not able to reduce the font,here my code: TextArea big = new TextArea(detailNews.getDescription()); Font createSystemFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL); big.getStyle().setFont(createSystemFont); big.setEditable(false);,How can i reduce Font? – String Aug 10 '12 at 06:54
  • Are you using the resource editor? It will be easy for you to change the propierties of your styles using the .res file – Mun0n Aug 10 '12 at 06:56
  • Can you answer this with piece of sample code,i downknow about that? – String Aug 10 '12 at 06:59
  • 2
    Th resource editor is a tool that helps you to create styles, interfaces, from a user friendly application. This could be exported in a .res file and used by code. You can start here: http://www.youtube.com/watch?v=uwZ98s4iiRU – Mun0n Aug 10 '12 at 07:06
  • Hi,i have created custom Font in Font.res file using resource.jar file,How can i apply the Font to my text area? – String Aug 10 '12 at 08:33
  • 1
    Ok, what you need to do now is the following: Create a theme and add the font to the TextArea If you want to change the font from code---> Create another theme with the new font size and add it to the text area You need to open the res from code Resources res = Resources.open("/MyRes.res"); and later UIManager.getInstance().addThemeProps(res.getTheme("nameoftheme")); – Mun0n Aug 10 '12 at 09:54
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/15166/discussion-between-pavan-kumar-ragi-and-jmunoz) – String Aug 10 '12 at 10:12
  • hi,i have used the below code: try { Resources res = Resources.open("/res/font.res"); UIManager.getInstance().setThemeProps(res.getTheme("Font1")); } catch (IOException e) { e.printStackTrace(); } i am facing java.lang.ClassCastException – String Aug 10 '12 at 10:19
  • HI,i have generated my project using Resource Editor,but when i run my application ,i am facing Uncaught exception java/lang/NoClassDefFoundError: com/app/XMLMidlet: com/sun/lwuit/events/ActionListener?... – String Aug 11 '12 at 06:26
  • What emulator are you using? Sun wireless toolkit 2.5.2 or higher? Import all the packets in the propierties of the emulator – Mun0n Aug 12 '12 at 22:21
  • i am using Nokia SDK 1.0 EMULATOR – String Aug 13 '12 at 05:02
  • Use this if you can please http://www.oracle.com/technetwork/java/download-135801.html – Mun0n Aug 13 '12 at 07:16