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 7438631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:35:05+00:00 2026-05-29T10:35:05+00:00

I am developing a bb application for which i want to center a button.

  • 0

I am developing a bb application for which i want to center a button. I am not using a custom field manager.
Below is some of my code:

        ButtonField button;
        button=new ButtonField( "Go!" );
        add(button);

I will like this button to be centered on the screen. Need help. Thanks

I tried that Paul…it did not work…here is my code for the mainscreen:

                class Vfmdemo  extends UiApplication {
               // main method
                public static void main(String[] args) {

                Vfmdemo theApp = new Vfmdemo();
                UiApplication.getUiApplication().pushScreen(new VFMScreen());
                theApp.enterEventDispatcher();

                }



                }

              // VFM
            class VFMScreen extends MainScreen {

           public VFMScreen(){

     // create a manager and allow scrolling when lots of fields are added
       VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL);

      // add a label
     vfm.add(new LabelField("VerticalFieldManager..."));

    // add another label
    vfm.add(new LabelField("default horizontal alignment is left"));

    // add another label that takes up full screen width
   vfm.add(new LabelField("using all width & long label...",
     LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
   // add another label that takes centered horizontally
     vfm.add(new LabelField("horizontally centered...",
        Field.FIELD_HCENTER));
         vfm.add(new ButtonField("Go!!",Field.FIELD_HCENTER));
    // add vfm to screen
      add(vfm);

         }
  • 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-05-29T10:35:06+00:00Added an answer on May 29, 2026 at 10:35 am

    You will need to use a pair of managers like this:

    // Center a field on the screen using managers

    HorizontalFieldManager hfm = new HorizontalFieldManager(USE_ALL_HEIGHT);
    
    VerticalFieldManager vfm = new VerticalFieldManager(USE_ALL_WIDTH | FIELD_VCENTER);
    
    vfm.add(new ButtonField("Go!", FIELD_HCENTER));
    
    hfm.add(vfm);
    
    add(hfm); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application in which I am using HTML documents.Now I want
I am developing an application in which I want to do some thing when
I am developing android application in which i want to convert html code in
I developing an application in which i want to print the values on a
I am developing an application in which I want to record the sound of
I am developing an application in which I want to use push notification service.
I am developing an iPhone application in which I want to show nearest restaurants
I'm developing a Silverlight 3 Application which I want to connect to a webservice
I developing an application in which i calling web services on iphone. I want
i developing an application in which i want to bind my own parameter with

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.