Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7751935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:40:33+00:00 2026-06-01T11:40:33+00:00

I want my application to align two field, one to left and other to

  • 0

I want my application to align two field, one to left and other to extreme left of the screen. For that i am using GridLayoutManager class. Here is my code

GridFieldManager gridFieldManager = new GridFieldManager(2,2, GridFieldManager.PREFERRED_SIZE_WITH_MAXIMUM); 

gridFieldManager.add(new ButtonField("Button One"), Field.FIELD_HCENTER);  
gridFieldManager.add(new ButtonField("Button Two"), Field.FIELD_RIGHT);  

gridFieldManager.add(new ButtonField("HC", Field.FIELD_HCENTER)); 
gridFieldManager.add(new ButtonField("RT", Field.FIELD_RIGHT));

add(gridFieldManager);

And, here is my output in simulator

enter image description here

Can anyone please help me to align the Button Two to the extreme right of the screen ? Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:40:34+00:00Added an answer on June 1, 2026 at 11:40 am

    Please use this following class.

    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    
    public class HFMLeftFieldRightField extends HorizontalFieldManager {
    
     private Field leftField;
     private Field rightField;
    
     private final static int TOP_MARGIN = 0;
     private final static int LEFT_MARGIN = 30;
    
     public HFMLeftFieldRightField() {
      super(USE_ALL_WIDTH);
     }
    
     public HFMLeftFieldRightField(boolean isQatari) {
      super(USE_ALL_WIDTH | Field.FIELD_LEFT);
     }
    
     public void sublayout(int maxWidth, int maxHeight) {
    
      super.sublayout(maxWidth, maxHeight);
      int width = getWidth();
    
      if (rightField != null) {
       int x = width - rightField.getWidth() - LEFT_MARGIN;
       int y = TOP_MARGIN;
       setPositionChild(rightField, x, y);
      }
      if (leftField != null) {
       int y = TOP_MARGIN+rightField.getHeight()/5;
       int x = LEFT_MARGIN;
       setPositionChild(leftField, 0, y);
      }
    
      setExtent(maxWidth, rightField.getHeight() + TOP_MARGIN * 2);
     }
    
     public void setLeftButton(Field leftField) {
      this.leftField = leftField;
    super.add(leftField);
     }
    
     public void setRightButton(Field rightField) {
      this.rightField = rightField;
      super.add(rightField);
     }
    
    
    }
    

    And add field this way.

    HFMLeftFieldRightField hfm = new HFMLeftFieldRightField();
    hfm.setLeftButton(new EditField("Left"));
    hfm.setRightButton(new EditField("Right"));
    add(hfm);
    

    More detail http://keraisureshvblackberry.blogspot.in/2012/02/there-are-very-common-there-there-are.html

    Hope helpfull..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two QGraphicsView that are of equal width, one ontop the other in
I want my application to encrypt a user password, and at one time password
I m building an application for Arabic and in this i want that i
I have a problem in my application design. I want to set vertical align
I am making an application for an android phone using eclipse, I want to
In my codeigniter application i want to display the uri segments.Iam using ajax to
I am using tinymce editor in my asp.net application, I want to implement the
In my application i am displaying textvalue one below the other from database which
I want to write an application that sends html formatted email. I have the
I am not familiar with dojo. I have this application I am using that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.