Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 155
Registered: ‎05-20-2009
My Device: Not Specified

Re: progress Bar display

I tried that option also but I am not able to attach any attachments.

Could u plz tell me how to add title for that progressbar displaying in alertbox.

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: progress Bar display

See When I use the popUpScreen Instead of MainScreen, The screen will be Displayed as a Dialog. Do you mean You would like to See the options like YES, NO in the popup Screen.

 

 


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 209
Registered: ‎11-08-2008
My Device: Not Specified

Re: progress Bar display

Hi,

Take  LabelField, and add that Labelfield object to tha Manager(DialogManager,VerticalfieldManager, HorizontalFieldManager).

And if you still have problem then plz paste your code.

Thanks and Regards
Developer
Posts: 155
Registered: ‎05-20-2009
My Device: Not Specified

Re: progress Bar display

Hi,

 

      I have tried like that, but it is not working....Can u plz check my code and suggest me.

 

package com.rim.samples.device.helloworld; import java.lang.*; import java.lang.String; import java.util.*; import java.io.*; import net.rim.blackberry.api.menuitem.*; import net.rim.blackberry.api.mail.*; import net.rim.blackberry.api.pim.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.system.*; import net.rim.blackberry.api.browser.Browser; import net.rim.blackberry.api.browser.BrowserSession; import net.rim.device.api.ui.component.Status; import java.io.IOException; import java.io.OutputStream; import javax.microedition.io.Connector; import javax.microedition.io.HttpConnection; import javax.microedition.lcdui.Ticker; import javax.microedition.lcdui.TextBox; import javax.microedition.lcdui.Font.*; import net.rim.device.api.ui.ContextMenu.*; import net.rim.blackberry.api.invoke.*; import net.rim.blackberry.api.phone.* ; public class Progress extends UiApplication { //statics ------------------------------------------------------------------ public static void main(String[] args) { Progress theApp = new Progress(); theApp.enterEventDispatcher(); } public Progress() { pushScreen(new ProgressScreen()); } } class ProgressScreen extends PopupScreen//MainScreen { public static AutoTextEditField Num; Timer timer; GaugeField percentGauge = null; int i =0; DialogFieldManager manager; public ProgressScreen() { super(new VerticalFieldManager()); LabelField title = new LabelField("Welcome to Reliance",LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); //setTitle(title); manager.add(title); percentGauge = new GaugeField("Please Wait.... ", 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(); UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { close(); } }); } } } public boolean onClose() { System.exit(0); return true; } public boolean keyChar(char key, int status, int time) { //intercept the ESC key - exit the app on its receipt boolean retval = false; switch (key) { case Characters.ESCAPE: onClose(); retval = true; break; } return retval; } }

 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: progress Bar display

Not working means, Is it giving any exception? What does it show on the screen?

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 155
Registered: ‎05-20-2009
My Device: Not Specified

Re: progress Bar display

After run the application, it is showing the error in the line as given below...

 

----> manager.add(title);

 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: progress Bar display

Just write add(title).

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 155
Registered: ‎05-20-2009
My Device: Not Specified

Re: progress Bar display

Thanks a lot, It is working fine...now.

 

Again I have small query...for this.

 The title text size and progressbar text size is same....I want to reduce title text size small...how to do that..

and I want to set background color for that title...Plz help me out.

Highlighted
Developer
Posts: 209
Registered: ‎11-08-2008
My Device: Not Specified

Re: progress Bar display

Here i see two errors

1) You declared as DialogFieldManager manager; but you defined it no where.

2 You are adding LabelField as manager.add(title); but you are not adding manager to your PopUpScreen.

So here is some part of your code, please rectify it. And i suggest you to change the DialogFieldManager from VerticalFieldManager.

And dont forget to import VerticalFieldManager class i.e  

import net.rim.device.api.ui.container.VerticalFieldManager;
      

      VerticalFieldManager manager;  // change DialogFiledManager manager; this is the line just above constructor
     
      public ProgressScreen()
      {
          super(new VerticalFieldManager());
         LabelField title = new LabelField("Welcome to Reliance",LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
         //setTitle(title);

         manager = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL);  // please add this line
         manager.add(title);
          percentGauge = new GaugeField("Please Wait.... ", 0, 100,   0,GaugeField.PERCENT);
          manager.add(percentGauge); // please do a correction here
          timer = new Timer();
          timer.schedule(new RemindTask(),1000,1000);

          add(manager); // please add this line
      }

Thanks and Regards
Developer
Posts: 209
Registered: ‎11-08-2008
My Device: Not Specified

Re: progress Bar display

Font fon = Font.getDefault().derive(Font.BOLD, 12);

// here you can increase the size by changing 12 to some heigher value. And decrease the size by lowering 12

 

And set this Font value to your Label object i.e add 1 more line as

 

title.setFont(fon); // add this line

Thanks and Regards