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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:11:37+00:00 2026-06-08T09:11:37+00:00

I am developing an application which requires me to create a progress bar moving

  • 0

I am developing an application which requires me to create a progress bar moving from right to left.

I tried using GaugeField by filling startVal as 100 and then on decrementing it but I couldn’t achieve it.

Is there any way in BlackBerry say paint() method or drawRect() using timer where we can fill it from right to left?

  • 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-08T09:11:38+00:00Added an answer on June 8, 2026 at 9:11 am

    Check following code for an implementation of Custom GaugeField.

    Output

    Implementation of CustomGaugeField

    class CustomGaugeField extends GaugeField {
        // Default constructor, need improvement
        public CustomGaugeField() {
            super("", 0, 100, 0, GaugeField.PERCENT);
        }
    
        // Colors
        private static final int BG_COLOR = 0xd6d7d6;
        private static final int BAR_COLOR = 0x63cb52;
        private static final int FONT_COLOR = 0x5a55c6;
    
        protected void paint(Graphics graphics) {
            int xProgress = (int) ((getWidth() / 100.0) * getValue());
            int xProgressInv = getWidth() - xProgress;
    
            // draw background
            graphics.setBackgroundColor(BG_COLOR);
            graphics.clear();
    
            // draw progress bar
            graphics.setColor(BAR_COLOR);
            graphics.fillRect(xProgressInv, 0, xProgress, getHeight());
    
            // draw progress indicator text
            String text = getValue() + "%";
            Font font = graphics.getFont();
            int xText = (getWidth() - font.getAdvance(text)) / 2;
            int yText = (getHeight() - font.getHeight()) / 2;
            graphics.setColor(FONT_COLOR);
            graphics.drawText(text, xText, yText);
        }
    }
    

    How to use

    class MyScreen extends MainScreen {
    
        public MyScreen() {
            setTitle("Custom GaugeField Demo");
            GaugeField gField;
            for (int i = 0; i < 6; i++) {
                gField = new CustomGaugeField();
                gField.setMargin(10, 10, 10, 10);
                add(gField);
            }
            startProgressTimer();
        }
    
        private void startProgressTimer() {
            TimerTask ttask = new TimerTask() {
                public void run() {
                    Field f;
                    for (int i = 0; i < getFieldCount(); i++) {
                        f = getField(i);
                        if (f instanceof CustomGaugeField) {
                            final CustomGaugeField gField = (CustomGaugeField) f;
                            final int increment = (i + 1) * 2;
                            UiApplication.getUiApplication().invokeLater(
                                new Runnable() {
                                    public void run() {
                                        gField.setValue((gField.getValue() + increment) % 101);
                                    }
                                }
                            );
                        }
                    }
    
                }
            };
    
            Timer ttimer = new Timer();
            ttimer.schedule(ttask, 1000, 300);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I am developing an Application which requires getting sensitive information from a database
I am developing an application which requires the user to drag a file from
I am developing an application which requires real-time updates to the end user. However,
I am developing an application which requires to add Calendar event. I have written
I'm developing an android application which requires background updates of my location . I
I am developing an Erlang application which requires a LOT of DB writes. My
I am developing an application in Android 2.1 which requires loading of views dyamically
I am developing a Django application, which is a large system that requires multiple
I am developing an application which requires the reading and writing of XML files.
I'm developing a small application which requires adding user-defined values to a grid. Problem

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.