views:

417

answers:

1

Hello All,

Is it possible to resize the width of horizontal manager. I want to create two buttons in horizontal manag, set the background border. I am using the following code for that. It is working fine. But as there are only two buttons and doesn't occupy the entire screen of 320 width, setting border is happening only for those two buttons background. So i could see the white space apart from the horizontal width in forward and backward spaces. So i want to create a Horizontal manager itself with 320 width, so that setting border color will show for the entire width. Is it possible to resize the width of horizontal manager?

XYEdges borderColor = new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK); XYEdges noPadding = new XYEdges(2, 2, 2, 2);

HorizontalFieldManager hzBtnFldManager = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER);

createButton = new CustomControl("Create", ButtonField.FOCUSABLE | ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER, 83, 15); cancelButton = new CustomControl("Cancel", ButtonField.FOCUSABLE | ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER, 83, 15);

hzBtnFldManager.add(createButton); hzBtnFldManager.add(cancelButton);

Border btnBarPaddingBorder = BorderFactory.createSimpleBorder(noPadding, borderColor, Border.STYLE_SOLID);
hzBtnFldManager.setBorder(btnBarPaddingBorder); hzBtnFldManager.setBackground(BackgroundFactory.createSolidBackground(Color.GRAY));

this.setStatus(hzBtnFldManager);

+2  A: 

Maybe try using the Field.USE_ALL_WIDTH style on the HorizontalFieldManager?

Marc Novakowski
Resolved. Thank you very much.