GaugeField

Hi all

I want to add a GaugeField for my screen. I added the following code:

GaugeField percentGauge = null;

percentGauge = new GaugeField ("waiting for the launch Conference:", 1, 100, 29, GaugeField.PERCENT);

Add (percentGauge);

This shows only a bar prograss and the percentage of the gauge does not increase.

Please help me with the gaugefield. How can I increase the percentage?

Thank you

This is just example. You can implement your own way and according to the needs. After every second your gauge will fill.

Timer timer;
GaugeField percentGauge = null;
int i =0;
--------------------------------
percentGauge = new GaugeField("Waiting.... ", 0, 100, 0,GaugeField.PERCENT);
add(percentGauge);
timer = new Timer();
timer.schedule(new RemindTask(),1000,1000);
-----------------------------------------
class RemindTask extends TimerTask
{
       public void run()
       {
           if(i < 100)
           {
               i += 10;
               percentGauge.setValue(i);
          }
            else
               timer.cancel();
     }
}

Tags: BlackBerry Developers

Similar Questions

  • Help neeeded on the GaugeField

    Hello

    can someone help me in showing how to add a border color for the GaugeField

    Thank you

    sujithRavindran

    GaugeField percentGauge = new GaugeField("Waiting.... ", 0, 100, 0,GaugeField.PERCENT)
            {
                public void paint(Graphics g)
                {
                    g.setColor(0xFF0000);
                    g.drawRect(0, 0, this.getWidth(), this.getHeight());
                    super.paint(g);
                }
            };
    
  • Interactive GaugeField on the BlackBerry Storm

    I just tried to create a modifiable on my BlackBerry Storm GaugeField, I used the constant can be CHANGED and made sure that there is enough space to select. It does not work, an interactive GaugeField only works on devices touch non-ecran?

    If so someone changed the GaugeField so it will work on a touchscreen device?

    Otherwise what could I do it wrong?

    I realized thinking about how it would be possible to make this is interactive and realized that as a last before amending the TouchEvent code should try to make the active gauge because it does not seem to focus. Added Field.FOCUSABLE and it worked.

  • How to edit GaugeField?

    Hi all

    How to edit GaugeField? Detault is press the alt + roll, the gaugefield is editable, how to change this option? How to use change Option in the menu item? How to change the editable option? A function or method is here? I want to use only the "Roll" button to change the gauge field, if possible?

    Hello

    you will find this use of full forum post.  There little code.

    http://supportforums.BlackBerry.com/T5/Java-development/custom-gauge-field/m-p/392374/highlight/true...

    Thank you

  • JVM 104 Exception on GaugeField progress implementing?

    Hello

    I use Eclipse for Java in BlackBerry plugin. I am fairly new to BlackBerry App development. I am trying to create a GaugeField that will show how to complete the year, nothing complicated. When I try to build the GaugeField with a variable as the percent it gives me "JVM 104". I tried to use setValue instead, but it gives me the same result... Any ideas?

    Thank you

    Ben

    Here are two examples of what I do, I put end to 50 for example.

    int Completion = 50;GaugeField percentGauge = new GaugeField("Percent: ", 1, 100, Completion, GaugeField.PERCENT);add(percentGauge);
    
    int Completion = 50;GaugeField percentGauge = new GaugeField("Percent: ", 1, 100, 0, GaugeField.PERCENT);percentGauge.setValue(Completion);add(percentGauge)
    

    The debugger gives you a "trace of the stack", which lists all the different methods that were called.  look towards the bottom of the list, that it gives you and you should understand which statement in your program has caused the problem.

    I wonder if you must set the minimum value of 0, to use it as a percent.

  • Change the color of the bar GaugeField

    Hello.

    I would like to change the color of the bar in a GaugeField. My code is:

    int current = obj.getInt("nu_votos");
    final int color = BBUtils.hex2Rgb(obj.getString("nu_color"));
    GaugeField gf = new GaugeField("", 0, total, current,
            GaugeField.NO_TEXT) {
        protected void paint(Graphics g) {
            g.setBackgroundColor(color);
            super.paint(g);
        }
    };
    

    However, I still get the same blue color...

    TIA

    Yamil

    set up your own domain, it is not so difficult.
    or you can take a look on the field of gauge bitmap here:
    http://supportforums.BlackBerry.com/T5/Java-development/implement-advanced-buttons-fields-and-manage...

  • How to change the default color of GaugeField?

    Hi all

    BlackBerry GaugeField the default color is blue. How to change the default of GaugeField color? How to override?

    Thank you

    Try with this example a and modify according to your needs

    Field GaugeField = new GaugeField ("", 0, 100, 20, GaugeField.FOCUSABLE) {}
    protected void paint (Graphics graphics) {}
    graphics.setColor (Color.RED);
    graphics.fillRect (0, 0, (Display.getWidth (/getValueMax ())) * getValue (), getHeight());
    }
    };

    There is no label for gauge field.

    If you want a labelfield and sepately use a labelfield and add this labelfield with this gaugefield in a horizontal handler, then use getwidth() instead of Display.getWidth ().

  • GaugeField Query

    How can I change the default color of gaugeField.

    By default, gaugeField color is blue. How can I make this yellow color. ?

    If I replace the paint gaugeField like this method:

    protected void paint (Graphics graphics)

    {

    }

    The gaugeField cannot be seen. Its colors become transparent.

    If I do:

    protected void paint (Graphics graphics)

    {

    graphics.setBackgroundColor (Color.YELLOW);

    }

    It does not work... It seems that by default.

    This could be a solution.

    protected void paint (Graphics g)
    {
    g.setColor (Color.YELLOW);
    g.fillRect (0,0, (gauge.getValue () * 2), 15);
    }

    Do not write---> super.paint (g);

  • load stored data / gaugeField

    I have problems without end trying to store/retrieve my data... regardless of the format, in that I try, it seems to hang my bb for several seconds regardless of what I do when loading or storage.  currently I have a structure of the object that allows me to export everything to delimited strings that I put into a vector, I then store this vector. When I insert the vector, I just go through it and parse each string to recreate the data structure.  However, even with store the vector (instead of the things I did before), it still blocks the app.

    in any case, now, I'm trying to get a gaugefield to work to view the progress of the load - initialized to the size of the vector, incrememented I go through the loop through vector.  Start-up of my application, manufacturer (required) loadVector... the only way for me to get the screen to view and then lock up was to use UiApplication.getUiApplication () .invokeLater (). to that I get the persistent vector, initialize the gaugefield and browse the vector to analyze strings to my objects.  but my gaugefield never load so it never updates.  When I try to move things around so somethings are before the invokelater thread, sometimes I can get the gaugefield to show, but it does not update.

    Any IDE? or am I just completely go at this the wrong way?

    Of course, the biggest problem is that none of this seems to be testable on the Simulator, as loading/backup is almost instantaneous. How could someone test something like that? IM thinking a sleep (xxx) in the for loop would contribute to simulate the amount of time it takes a real device to save?

    Thanks for your suggestions...

    OK so much for most of it... I had to put my call to initialize gaugefield in a uiapp.invokelater to initialize and add it to the status bar, then use an ordinary phone to browse the vector and update the value of gaugefield. works so far (on the SIM anyway)

  • time while using progressindicator and GaugeField

    HII, when I use a progressIndicator and Gaugefield in animated form, how do I know how match time I'll give you that it ends in the same time whith the functioning of httpconnection for get data or send data to the server

    no reliable way, no.
    If you know how the file you download is great you can check the current status during the download of course.
    otherwise, you can check how much you've downloaded, but you have no idea the percentage.

  • LabelField after GaugeField does not appear

    Hello

    I am trying to add a LabelField LabelField - GaugeField - inside a HorizontalFieldManager.

    The two labels are added that I can assure you by bandwidth occupied by the gauge.

    But I do not see the second label. It's like he disappeared.

    HorizontalFieldManager hfm = new HorizontalFieldManager();
    
    LabelField lf1 = new LabelField("hi");
    GaugeField gf = new GaugeField("" , 1 , 100 , 30 , GaugeField.NO_TEXT);
    LabelField lf2 = new LabelField("bye");
    
    hfm.add(lf1);
    hfm.add(gf);
    hfm.add(lf2);
    
    add(hfm);
    

    I tried to add gaugeField in HorizontalFieldManager another then and add it like this.

    HorizontalFieldManager hfm = new HorizontalFieldManager();
    HorizontalFieldManager hfm2 = new HorizontalFieldManager();
    
    LabelField lf1 = new LabelField("hi");
    GaugeField gf = new GaugeField("" , 1 , 100 , 30 , GaugeField.NO_TEXT);
    LabelField lf2 = new LabelField("bye");
    
    hfm2.add(gf);
    
    hfm.add(lf1);
    hfm.add(hfm2);
    hfm.add(lf2);
    
    add(hfm);
    

    But even if that did not help. The second label is always invisible

    Can someone help me out here?

    I use

    BlackBerry 9530-Verizon

    OS version: 5.0.0.32 8

    Thank you

    I got the answer

    Instead of creating the second hosidontalFieldManager at the beginning

    I created it after I created objects of lf1 and lf2.

    now I set the width of this hfm2 to

    getPreferredWidth() - timeStart.getPreferredWidth() - timeEnd.getPreferredWidth() ,getPreferredHeight()
    

    This will subtract the width occupied by total width label and set the width of the gauge so that the space remaining.

    HorizontalFieldManager hfm = new HorizontalFieldManager();
    
    LabelField lf1 = new LabelField("hi");
    GaugeField gf = new GaugeField("" , 1 , 100 , 30 , GaugeField.NO_TEXT);
    LabelField lf2 = new LabelField("bye");
    
    HorizontalFieldManager hfm2 = new HorizontalFieldManager(){
        public void sublayout(int maxWidth, int maxHeight) {
            super.sublayout(getPreferredWidth() - lf1.getPreferredWidth() - lf2.getPreferredWidth() ,getPreferredHeight());
            setExtent(getPreferredWidth() - lf1.getPreferredWidth() - lf2.getPreferredWidth() , getPreferredHeight());
        }
    };
    hfm2.add(gf);
    
    hfm.add(lf1);
    hfm.add(hfm2);
    hfm.add(lf2);
    
    add(hfm);
    
  • GaugeField - pop stops at the mouse, selection of other fields

    Hi people,

    I use Eclipse 3.4 with the latest plugin 4.7 and the 9530 Simulator.

    I have a screen that has 4 radio buttons in a RadioButton group.

    Below that I have a MODIFIABLE GaugeField that I use as the Audio Volume control.

    Initially, I can move on radio buttons with the keyboard and mouse. I can choose and everything works fine.

    If I click on the GaugeField, a popup unwanted system appears saying:

    "Use the roller to change the option.
    Instead of using this dialog box.
    try to use Alt + roll.

    The context menu contains a GaugeField and allows me to select the new settting.

    Now: The mouse is no longer will allow me to select the radio buttons.  If I use the keyboard to move the focus to select, a Radiobutton then the ability of the mouse to select the option buttons started working again.

    (1) on the Simulator, how can I get the mouse works again after setting the GaugeField without having to manually move the focus on the GaugeField through my PC keyboard?

    (2) how to stop pop up system?  I want to just the user to adjust the GaugeField to the screen.

    Ken Kelly


  • User interface controls

    Hello

    I am analyzing the user interface controls for my application using the format shown in this picture.

    http://picasaweb.Google.com/shikha5579/SampleImages#5471685377447771410

    Small circles are the user interface controls buttons (to be made available by trackball) as power, speed, battery, etc. Below is the slider bar showing the progress of the video displayed in the central part of the screen.

    My question is, such a user interface can be created for blackberry-driven keyboard? If Yes, how should I go about this?

    Thank you!

    GaugeField done something similar, but take a look at this:

    How - to implement advanced buttons, fields and managers
    Article number: DB-00796
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

  • JVM 104 - Illegal Argument Exception (wait, what?)

    Friends and enemies,

    I am the developer of a BlackBerry app that works very well for over a year.  All of a sudden, I'm going to run the Simulator, and I get an exception error Uncaght JVM (not on the launch, but medium-term), specifically, the JVM 104 illegal Argument Exception.  I did not any changes to the code in > 3 months, my last run of the application on the Simulator was a week ago.

    This is where it gets crazy... If I create a new project in Eclipse using the code EXACT EVEN the above request, the Simulator works perfectly.  What could have happened to my configuration of a project that builds an illegal Exception of Argument?

    I ran clean.bat on all my simulators. The only change I made on my test machine is to install Adobe Photoshop CS5 (shouldn't really affect anything).

    All the world has already seen this problem?

    Help, please

    JRT

    Oudu a few hours and several breakpoints, I found the problem. Apparently, update a GaugeField using .setValue (int) can throw an Exception of the illegal Argument? But only once a year. I don't know why it was a problem now, the code has been stagnant...?

    SOLUTION:

    try {}

    Update GaugeField

    }

    catch (IllegalArgumentException foo)

    {

    }

    BOOYA! FTW

  • Menu remains visible after you make the selection, and does not show Popupscreen

    Hey. Unable to get a (a gaugefield) on a Popupscreen progress bar to show. It is called from a menu. The user clicks a menu item, and a method is called. The method among other pushes a Popupscreen containing a Gaugefield on display battery-code below. Then, he starts a thread which downloads an image and using join() to wait for it complete (long story). Then, in the thread of events, it appears the Popupscreen.

    The menu does not disappear when you click on it in the Simulator (JDE 4.7, the Bold 9700 sim), but the download happens. Once the download is complete, the menu disappears, the Popupscreen is shown and he tried to pop() Popupscreen, causing an IllegalArgumentException.

    I tried to split the method into two methods, the download happened in the 2nd method, because I read the forum search that the UIEngine don't update the display until the method finishes (it runs in the event thread). But it made no difference...

    How can I get this menu to disappear immediately and the push (popup) to work?

    See you soon!

    Justin.

                            progressbar = new GaugeField("", 0, 100, 50, GaugeField.NO_TEXT);
                            progress = new PopupScreen(new FlowFieldManager()) { protected void OnDisplay() { super.onDisplay(); /*cancelButton.setFocus();*/  }  };
                            globalTiles.pushScreen(progress);
    
                            progress.add(new LabelField("Downloading (rest of) picture ..."));
                            progress.add(progressbar);
                            progress.setFocus();
    
                            if (!threadbg.isAlive()) {
                                       threadbg = new ThreadForBgDownload();
                                       threadbg.start();
                            }
                            else {
                                       // Show the progress bar, mostly complete (it is running and was in the bg). Game will start after last bit done
                            }
    
                            threadbg.join(); // Wait for download thread to complete and 'die'
    
                            globalTiles.popScreen(progress);
    

    Rule #1: all display updates should occur on the thread event or synchronized on the lock of the event.

    Rule #2: the thread of events (or now the lock of the event) should never be blocked by lengthy operations.

    The scenario you sketched out is usually handled like this: menu item run() method don't whatever immediate user interface updates are necessary and starts a worker thread. It does not wait until the thread ends before returning. (If so, updates the user interface include pushing a "Please wait" or progress pop up). The worker, at the same time, begins to do its stuff. When it's time to update the user interface (either because the task is completed or to view progress) the worker thread usually called invokeLater (Runnable) (a method in the Application class) where the executable run() method updates the user interface. If the worker thread must receive user input in his work, he can use invokeAndWait (Runnable), where the executable not all interactions of the user and stores the user entry somewhere so that the worker thread can grab after invokeAndWait() returns.

    Although the synchronization on event lock works perfectly well, it is more common for some reason any to invoke a Runnable, perhaps because the latter clearly encapsulates in a separate object the work to be done on the event thread.

    The above policy is the basis of the excellent Peter Strange example I linked to before.

Maybe you are looking for