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
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900

how to increase the width of popup screen

i have created a pop up screen now how can i increase the width of popup screen.

 

public class SettingMenu extends PopupScreen{
			 
			 HorizontalFieldManager pophrm,pophrm2,pophrm3,pophrm4;
			
			 
			 public SettingMenu(){
				 super(new VerticalFieldManager(), Screen.DEFAULT_CLOSE); 
				
				 this.setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 80));
			
				 setBorder(BorderFactory.createSimpleBorder(new XYEdges(),Border.STYLE_TRANSPARENT));
				
				 pophrm = new HorizontalFieldManager();
				 pophrm2 = new HorizontalFieldManager();
				 pophrm3 = new HorizontalFieldManager();
				 pophrm4 = new HorizontalFieldManager();
				 
				 Bitmap bitmapImagee = Bitmap.getBitmapResource("fav_pressed.png");
			     BitmapField fieldDemo = new BitmapField(bitmapImagee,FOCUSABLE);   
			     
			     LabelField label = new LabelField(" Favourites"){
			    	 public int getPreferredWidth() {
							// TODO Auto-generated method stub
							return 122;
						}
			     };
			     
			     pophrm.setBorder( BorderFactory.createSimpleBorder( new XYEdges(2, 2, 2, 2),
		                 new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
			     
			     pophrm.add(fieldDemo);
			     pophrm.add(label);
			     this.add(pophrm);
			     
			     
			     Bitmap bitmapImagee1 = Bitmap.getBitmapResource("fav_pressed.png");
			     BitmapField fieldDemo1 = new BitmapField(bitmapImagee1,FOCUSABLE);   
			     
			     LabelField label2 = new LabelField("  Settings"){

					public int getPreferredWidth() {
						// TODO Auto-generated method stub
						return 122;
					}
			    	 
			     };
			     pophrm2.setBorder( BorderFactory.createSimpleBorder( new XYEdges(0, 2, 2, 2),
		                 new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
			     pophrm2.add(fieldDemo1);
			     pophrm2.add(label2);
			     this.add(pophrm2);
			     
			     
			     Bitmap bitmapImagee3 = Bitmap.getBitmapResource("fav_pressed.png");
			     BitmapField fieldDemo3 = new BitmapField(bitmapImagee3,FOCUSABLE);   
			     
			     LabelField label3 = new LabelField("  Help"){
			    	 public int getPreferredWidth() {
							// TODO Auto-generated method stub
							return 122;
						}
			     };
			     pophrm3.setBorder( BorderFactory.createSimpleBorder( new XYEdges(0, 2, 2, 2),
		                 new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
			     pophrm3.add(fieldDemo3);
			     pophrm3.add(label3);
			     this.add(pophrm3);
			     
			     Bitmap bitmapImagee4 = Bitmap.getBitmapResource("fav_pressed.png");
			     BitmapField fieldDemo4 = new BitmapField(bitmapImagee4,FOCUSABLE);   
			     
			     LabelField label4 = new LabelField("  About"){
			    	 public int getPreferredWidth() {
							// TODO Auto-generated method stub
							return 122;
						}
			     };
			     pophrm4.setBorder( BorderFactory.createSimpleBorder( new XYEdges(0, 2, 2, 2),
		                 new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK), Border.STYLE_SOLID));
			     pophrm4.add(fieldDemo4);
			     pophrm4.add(label4);
			     this.add(pophrm4);
			     
			     
			 }
			 public boolean onClose(){
				 UiApplication.getUiApplication().popScreen(this);
				 UiApplication.getUiApplication().popScreen(mymenu);
				 
				 return true;
				 }
			
			 
		 }

 

 

9630.png

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: how to increase the width of popup screen

http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/ui/container/PopupScreen.html#...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to increase the width of popup screen

And there is also the option of using setMargin and./or setPadding for the contained Fields - see here:

http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/ui/Field.html