×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    25

    How to set action button 1 (right-most location of the header bar) for LWUIT form

    Hello All,

    Is it possible to set the Action Button 1 for a LWUIT form?

    http://www.developer.nokia.com/Resou...eader-bar.html

    FYI, I am using Nokia SDK 2.0 and Nokia LWUIT. Thanks in advance.

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2012
    Posts
    55

    Re: How to set action button 1 (right-most location of the header bar) for LWUIT form

    For full touch it is possible using Command. The last Command added will be displayed on the right action button unless you manually specify offset. If you are using back button make sure you add and set it before the other commands.

    Code:
    Form form = new Form("Action buttons!");
    
    Command exit = new Command("Exit") {
    	public void actionPerformed(ActionEvent e) {
    		System.out.println("Exit pressed!");
    		notifyDestroyed();
    	}            
    };
    
    Command fudge = new Command("Fudge") {
    	public void actionPerformed(ActionEvent e) {
    		System.out.println("Fudge pressed!");
    	}
    };
    
    Command chocolate = new Command("Chocolate") {
    	public void actionPerformed(ActionEvent e) {
    		System.out.println("Chocolate pressed!");
    	}
    };
    
    form.addCommand(exit);
    form.setBackCommand(exit);
    
    form.addCommand(fudge);
    form.addCommand(chocolate);	   
    
    form.show();
    The example should have chocolate as the right action button, fudge inside the menu and exit as the back command.

    Br,
    Villep

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    25

    Re: How to set action button 1 (right-most location of the header bar) for LWUIT form

    Thanks for your response. May I know if it possible to set the icon for it? It is currently showing a tick. Can I change it to different icon/image?

  4. #4
    Nokia Developer Expert
    Join Date
    Jun 2012
    Posts
    55

    Re: How to set action button 1 (right-most location of the header bar) for LWUIT form

    It is possible to change the icon. You can create a custom 20x20 icon as mentioned here. Then you can simply use the constructor of Command that takes an image as a parameter to use it.

    Br,
    Villep

Similar Threads

  1. How to add button action event On GUI application with UI design
    By mhbmhbmhb in forum Symbian User Interface
    Replies: 2
    Last Post: 2012-04-12, 12:09
  2. pass Text field value from one form to another form in LWUIT.
    By debasish_cse05 in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2011-01-13, 11:21
  3. problem in back and forth of LWUIT form and normal form in j2me
    By jugal.inani in forum Mobile Java General
    Replies: 8
    Last Post: 2010-06-09, 12:24
  4. Replies: 4
    Last Post: 2010-06-02, 14:06
  5. Action button in N97
    By chandran.biju007 in forum Symbian
    Replies: 6
    Last Post: 2010-04-01, 11:51

Posting Permissions

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