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

New Contributor
Posts: 3
Registered: ‎08-08-2010
My Device: Bold 9700
Accepted Solution

GridFieldManager with label getting wider

I've searched the forums, but could not find the answer to my problem. so, who can help me out here.


I've got a GridFieldManager, with 2 labels containing static text, and two labels with text that I want to change during runtime.


GridFieldManager gfm = new GridFieldManager(2, 2, Manager.USE_ALL_WIDTH | GridFieldManager.FIXED_SIZE);
gfm.setColumnProperty(0, GridFieldManager.FIXED_SIZE, 300);
gfm.setColumnProperty(1, GridFieldManager.FIXED_SIZE, 180);
float TMeasured = 180 / 10;
float TSetpoint = 195 / 10;
lTemperatureMeasured = new LabelField(Float.toString(TMeasured) + "°c");
lTemperatureSetpoint = new LabelField(Float.toString(TSetpoint) + "°c");
gfm.add(new LabelField("Temperature measured"), FIELD_LEFT);
gfm.add(lTemperatureMeasured, FIELD_LEFT);//RIGHT);
gfm.add(new LabelField("Temperature setting"), FIELD_LEFT);
gfm.add(lTemperatureSetpoint, FIELD_LEFT);//RIGHT);



the problem is, that when I change the text of a label, the GridFieldManager gets wider! it just grows and grows by something like 5 pixels. changing the fixed widths did not help.

I just can't figure out why this happens. who does?


Changing the text is done with a button:



public void fieldChanged(Field field, int context)
    if(field == bChangeTemperature)



BlackBerry Development Advisor
Posts: 15,876
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: GridFieldManager with label getting wider

This issue has been logged in Issue Tracker here:  https://www.blackberry.com/jira/browse/JAVAAPI-1341


Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
New Contributor
Posts: 2
Registered: ‎03-06-2009
My Device: Not Specified

Re: GridFieldManager with label getting wider

Just a note to say I found a solution/workaround for the GridFieldManager's growing field issue that at least worked for me.


After changes to the grid I call:




Maybe the padding values get changed incorrectly (and keep growing) and need to be reset???