Reputation: 401
I am using HorizontalFieldManager with Field.USE_ALL_WIDTH and Field.FIELD_HCENTER but Field.FIELD_HCENTER is not working below is how I am constructing HorizontalFieldManager
HorizontalFieldManager horizontalContainer = new HorizontalFieldManager(Field.USE_ALL_WIDTH | FIELD_HCENTER);
Upvotes: 1
Views: 560
Reputation: 3726
Try like this in separate class and see the output:
HorizontalFieldManager hr=new HorizontalFieldManager(Field.FIELD_HCENTER);
hr.add(new LabelField("Black",Field.FOCUSABLE));
hr.add(new LabelField("Berry",Field.FOCUSABLE));
add(hr);
Enough;
Upvotes: 0
Reputation: 3701
Declare in the following format
HorizontalFieldManager horizontalContainer = new HorizontalFieldManager(Field.USE_ALL_WIDTH |DrawStyle.HCENTER);
Upvotes: 1
Reputation: 8611
The Field class provides the following style bits for alignment:
Horizontal alignment styles
Vertical alignment styles
The horizontal alignment styles are only recognized when a Field is added to a VerticalFieldManager, and the vertical alignment styles only apply when a Field is added to a HorizontalFieldManager. Fields added to a HorizontalFieldManager are ALWAYS aligned to the left.
Upvotes: 5