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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:17:47+00:00 2026-06-03T23:17:47+00:00

I am working on the following code which has a welcome form with 6

  • 0

I am working on the following code which has a welcome form with 6 buttons.

On click of each of those buttons it opens a new form.

   class MyAPP extends UiApplication {
    public static void main(String[] args) {
            UiApplication instance = new MyAPP();
            instance.enterEventDispatcher();
    }
    private ButtonField btntest,btntest1,btntest2,btntest3,btntest4,btntest5;
    public MyAPP() {

            MainScreen testScreen = new MainScreen();


            final LabelField field  = new LabelField("Company",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE)
    {
        protected void paint(Graphics g)
            {       
                     g.clear();
                    g.drawRect(0,0, 50, 50);
                    int oldColor = g.getColor();
                    g.setColor(Color.DODGERBLUE);
                    g.fillRect(0, 0, this.getPreferredWidth(), this.getPreferredHeight());
                    g.setColor(oldColor);
                    g.drawRect(100, 100, 50, 50);
                    super.paint(g);
             }
    };
    testScreen.setTitle(field);


    //Add status field to bottom of screen in blue color

    final LabelField field1  = new LabelField(" Copyright")
    {
        protected void paint(Graphics g)
            {       
                  //   g.clear();
                    g.drawRect(0,0, 50, 50);
                    int oldColor = g.getColor();
                    g.setColor(Color.DODGERBLUE);
                    g.fillRect(0, 0, this.getPreferredWidth(), this.getPreferredHeight());
                    g.setColor(oldColor);
                    g.drawRect(100, 100, 50, 50);
                    super.paint(g);
             }

    };
    //field1.setFontColor(Color.WHITE);

        btntest1 = new ButtonField("Customer",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);  
        btntest = new ButtonField("Bills  ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
        btntest2 = new ButtonField("Ledger ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK); 
        btntest3 = new ButtonField("Receipts",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);


         btntest1.setChangeListener(new FieldChangeListener()
      {
           public void fieldChanged(Field field,int context) 
           {
              pushScreen(new NextScreen2());
           }
      });




     btntest.setChangeListener(new FieldChangeListener()
      {
           public void fieldChanged(Field field,int context) 
           {
              pushScreen(new NextScreen1());
           }
      });


      btntest2.setChangeListener(new FieldChangeListener()
      {
           public void fieldChanged(Field field,int context) 
           {
              pushScreen(new NextScreen4());
           }

      });

I have also tried putting an image bitmap that lies on the center of the form but it doesnt appear anywhere.

In the present code i have added title and status fields and also i have added

  1. An image to the top of the screen with welcome caption.
  2. There are 6 buttons that are center aligned.

Is it because the buttons are in center and there is no space left for the color implementation to take place that it is not visible?Also i am unable to add an image that stays as a background to the entire form.Anyone aware on a solution please guide.Thanks

  • 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-03T23:17:49+00:00Added an answer on June 3, 2026 at 11:17 pm

    Try following code:

    // initialize background
    Bitmap bm = Bitmap.getBitmapResource("myImage");
    Background bg = BackgroundFactory.createBitmapBackground(bm);
    
    // getMainManager(), apply background
    testScreen.getMainManager().setBackground(bg);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with the jQuery Validation plugin and I wrote the following code which
I have trouble to get gluLookAt working. I have the following code which works
I've implemented the following code on the site I'm working on which works great,
I have the simple following code, which is working in a ruby (not rails)
I just came accross the following code in an existent project, which I'm working
We have the following code working for a complex rails form with checkboxes. I'm
i have the following code which doesnt seem to be working: Context: I have
I am working on a project where I have a class which has UIView
I have the following code which doesn't seem to be working properly - is
I am working on an old application which has huge code from legacy. Application

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.