Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor yatin_indianic's Avatar
    Join Date
    Nov 2009
    Posts
    52
    hi

    i can not changing font-size of the Detail-text of swt.mobile.ListBox , my source code is below, please help me to find out what is solution for that?

    import org.eclipse.ercp.swt.mobile.ListBox;
    import org.eclipse.ercp.swt.mobile.MobileShell;
    .
    .
    .
    .
    .
    MobileShell currentShell = new MobileShell(Display.getCurrent(), SWT.MAX);
    currentShell.setLayout(new FillLayout(SWT.VERTICAL));
    String[] chpNames;
    .
    //at here i get some detail in String array in "chpNames"
    .
    .
    ..
    .
    CustomListBoxItem[] chapters = null;
    chapters = new CustomListBoxItem[chpNames.length];

    for(int i=0; i < chpNames.length;i++) {

    chapters[i] = new CustomListBoxItem(chpNames[i],false);

    }
    static final class CustomListBoxItem extends ListBoxItem {

    public CustomListBoxItem(String name,boolean voiceNoteExist) {
    this.setDetailText(name);
    this.setDetailIcons(icon);
    if(voiceNoteExist)
    this.setDetailIcons(iconSpeaker);
    }
    }
    ListBox listBox = new ListBox(currentShell, SWT.SINGLE|SWT.V_SCROLL|SWT.RESIZE,ListBox.LB_STYLE_NO_HEADING_TEXT | ListBox.LB_MOD_SHOW_DETAIL_ICONS);

    try {
    font23 =new Font(currentShell.getDisplay(),"Courier",6,SWT.NORMAL);
    listBox.setFont(font23);
    System.out.println("exception is not coming");
    }
    catch(Exception er){
    System.out.println("exception "+er);
    }

    //this method is using to change font-size of Detail-text of ListBox(specify in eswt API)--listBox.setFont(font23);

    when i run apps i see the printstatement is:--exception is not coming

    I have also find the limitation for the setfont(Font f) method of ListBox(has no effect)
    http://library.forum.nokia.com/index...CF112D8E6.html

    so please help me in that point "can i override the method of setfont(Font f) of ListBox and then i set the font-size of DetailText of ListBox" if you have any idea and some related code link, any example code then please give me that link or give me some new idea ?
    Last edited by yatin_indianic; 2010-01-20 at 09:35. Reason: I find the limitation for the setfont(Font f) method of ListBox(has no effect)

  2. #2
    Nokia Developer Champion Tiger79's Avatar
    Join Date
    Apr 2007
    Posts
    2,697
    Actually I don;'t know if swt is any different than MIDP but MIDP for example doesnt recognize a "courier" Font, it just knows three standard Fonts.. And three standard sizes...
    Have you tried placing the
    listBox.setFont(font23);
    in a try-catch and see if something happens in regards to thrown exceptions ?

  3. #3
    Regular Contributor yatin_indianic's Avatar
    Join Date
    Nov 2009
    Posts
    52
    Quote Originally Posted by Tiger79 View Post
    Actually I don;'t know if swt is any different than MIDP but MIDP for example doesnt recognize a "courier" Font, it just knows three standard Fonts.. And three standard sizes...
    Have you tried placing the
    listBox.setFont(font23);
    in a try-catch and see if something happens in regards to thrown exceptions ?
    hello friend i have also doing that:

    try {
    font23 =new Font(currentShell.getDisplay(),"Courier",6,SWT.NORMAL);
    listBox.setFont(font23);
    System.out.println("exception is not coming");
    }
    catch(Exception er){
    System.out.println("exception "+er);
    }
    and check the output
    output is :exception is not coming

    if you have any idea then reply me

  4. #4
    Setting Font to ListBox is not supported due to limitations in the platform. Follow this link for complete list of eSWT for S60 limitations:
    http://library.forum.nokia.com/index...CF112D8E6.html

    By the way, in eSWT, you have access to all the fonts existing in the device.
    To get the full list of fonts installed in the device use:

    Display.getCurrent().getFontList(null, true); // for scalable fonts
    Display.getCurrent().getFontList(null, true); // for non-scalable fonts

    Also you can use FontDialog to visually preview all the fonts of the device.

    Petru

  5. #5
    Regular Contributor yatin_indianic's Avatar
    Join Date
    Nov 2009
    Posts
    52
    Quote Originally Posted by Petru.Motrescu View Post
    Setting Font to ListBox is not supported due to limitations in the platform. Follow this link for complete list of eSWT for S60 limitations:
    http://library.forum.nokia.com/index...CF112D8E6.html

    By the way, in eSWT, you have access to all the fonts existing in the device.
    To get the full list of fonts installed in the device use:

    Display.getCurrent().getFontList(null, true); // for scalable fonts
    Display.getCurrent().getFontList(null, true); // for non-scalable fonts

    Also you can use FontDialog to visually preview all the fonts of the device.

    Petru


    thanks your reply buddy

    I find the limitation for the setfont(Font f) method of ListBox(has no effect)


    http://library.forum.nokia.com/index...CF112D8E6.html

    so please help me in that point "can i override the method of setfont(Font f) of ListBox and then i set the font-size of DetailText of ListBox" if you have any idea then please help me?

Similar Threads

  1. Problem with CAknDoubleStyleListBox with a CAknSearchField
    By jjig in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-09-17, 00:58
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36
  4. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12:36
  5. PJava runtime problem within Nokia 9210, Hrlp~!
    By Nokia_Archive in forum PersonalJava
    Replies: 1
    Last Post: 2002-05-28, 13:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved