×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    3

    Center Command in midlet

    Hi friends,

    I would like to know how to add a label for the Center Command button. Apparently the center button is the same as the Command.OK button, but i've changed mine according to the keyCode of the center button.

    How would i go about adding the Label for the center button.

    Thanks in advance

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: Center Command in midlet

    Hi,
    I guess you are working with canvas..correct...
    Well thats not impossible...follow like this...
    @ Draw the String at the exact location...I means center and just below the fire key..ok
    I hope you can draw the string ..
    if no then read the method,
    public void setLeftRightFireSoftKey( String leftString , String rightString , String fireString )
    {
    if( leftString != null )
    {
    g.setColor( 255 , 255 ,255 );
    g.setFont(FONT_BOLD_SMALL);
    g.drawString( leftString , 2 , getHeight() , g.LEFT | g.BOTTOM );
    }
    if ( rightString != null )
    {
    g.setColor( 255 , 255 ,255 );
    g.setFont(FONT_BOLD_SMALL);
    g.drawString( rightString , getWidth() , getHeight() , g.RIGHT | g.BOTTOM );
    }
    if ( fireString != null )
    {
    g.setColor( 255 , 255 ,255 );
    g.setFont(FONT_BOLD_SMALL);
    g.drawString( fireString , getWidth()/2 , getHeight() , g.BOTTOM| g.HCENTER );
    }
    }

    Hope this helps you,
    Thanks,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    3

    Re: Center Command in midlet

    Thanks raj_J2ME,

    great idea, ill try that when i get home tonight.

    Is there no center command in the nokia/samsung/SE etc. SDK? Just seems weird..

    Would it be possible to add Center command when working with a Form?

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: Center Command in midlet

    Quote Originally Posted by hurmin View Post
    Thanks raj_J2ME,

    great idea, ill try that when i get home tonight.

    Is there no center command in the nokia/samsung/SE etc. SDK? Just seems weird..

    Would it be possible to add Center command when working with a Form?
    Hi,
    Let me move step by step,
    @ There is not center command..just center key is used for selection..

    @ No I guess that can not be done..You can add the command only on the soft keys..

    However you can do follow the same as I told you in last post..

    Hope this can help you,
    Thanks,
    Last edited by raj_J2ME; 2008-11-27 at 12:44. Reason: add 1 line
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Center Command in midlet

    Quote Originally Posted by raj_J2ME View Post
    Hi,
    Let me move step by step,
    @ There is not center command..just center key is used for selection..

    @ No I guess that can not be done..You can add the command only on the soft keys..

    Hope this can help you,
    Thanks,
    Well for some items in a Form you can customize the select key's label using setDefaultCommand(...):
    Code:
    //For example, in a DateField
    public DateField df=new DateField("DateField Example 1", DateField.DATE_TIME);
    public Command sel=new Command("My Label", Command.SCREEN, 1);
    df.setDefaultCommand(sel);

  6. #6
    Registered User
    Join Date
    Nov 2008
    Posts
    3

    Re: Center Command in midlet

    Thanks guys!!
    Appreciate your help a lot

  7. #7
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    54

    Re: Center Command in midlet

    Hi
    Thank you for your useful reply
    It is also very useful to me

    sweetsweet24

Similar Threads

  1. calling midlet from midlet throws SecurityException on 6600
    By brianpegan in forum Mobile Java General
    Replies: 3
    Last Post: 2010-10-25, 05:31
  2. Opening connection to the secure element fails when restarting the midlet.
    By tfroidcoeur in forum Near Field Communication
    Replies: 6
    Last Post: 2007-08-24, 08:38
  3. 技术文档:MIDP 2.0安全机制 与 MIDlet 数字签名
    By wotrust in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 0
    Last Post: 2006-12-30, 07:42
  4. 'Response Unknown' when downloading midlet
    By Weevil in forum Mobile Java General
    Replies: 3
    Last Post: 2004-05-30, 17:01
  5. How to create two instances of midlet
    By marquito99 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-04-30, 01:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •