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: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: how to set coordinates, width and height for a Manager?

About your second problem: diving the screen into 4

-------------------------------

 

Try something like this.

 

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.system.*; class TestScreen extends MainScreen { VerticalFieldManager topLeftManager, topRightManager; VerticalFieldManager bottomLeftManager, bottomRightManager; HorizontalFieldManager topManager; HorizontalFieldManager bottomManager; TestScreen() { super(NO_VERTICAL_SCROLL); int width = Display.getWidth() /2; int height = Display.getHeight() /2; //top left manager topLeftManager = getCustomVerticalManager(0x00FF0000, width, height); //topLeftManager.setPadding(10, 0, 0, 10); topLeftManager.add(new LabelField("TopLeft")); //top right manager topRightManager = getCustomVerticalManager(0x0000FF00, width, height); topRightManager.add(new LabelField("TopRight")); //bottom left manager bottomLeftManager = getCustomVerticalManager(0x000000FF, width, height); bottomLeftManager.add(new LabelField("BottomLeft")); //bottom right manager bottomRightManager = getCustomVerticalManager(0x0000FFFF, width, height); bottomRightManager.add(new LabelField("BottomRight")); //top horizontal manager for (topleft + topright) topManager = new HorizontalFieldManager(Field.USE_ALL_WIDTH); topManager.add(topLeftManager); topManager.add(topRightManager); //bottom horizontal manager for (bottomleft + bottomright) bottomManager = new HorizontalFieldManager(Field.USE_ALL_WIDTH); bottomManager.add(bottomLeftManager); bottomManager.add(bottomRightManager); this.add(topManager); this.add(bottomManager); } public VerticalFieldManager getCustomVerticalManager(final int color, final int width, final int height) { VerticalFieldManager verticalManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR) { public void paint(Graphics graphics) { graphics.setBackgroundColor(color); graphics.clear(); super.paint(graphics); } protected void sublayout( int maxWidth, int maxHeight ) { int displayWidth = width; int displayHeight = height; super.sublayout( displayWidth, displayHeight); setExtent( displayWidth, displayHeight); } }; return verticalManager; } }

Regards

Bikas

 

 

Developer
Posts: 745
Registered: ‎01-04-2009
My Device: 8300, 8800, 8700f, 9000

Re: how to set coordinates, width and height for a Manager?

thx, thx thx !! You really helped me Smiley Happy

 

 kind regards

Highlighted
Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: how to set coordinates, width and height for a Manager?

You are welcome. Smiley Happy