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

Posts: 57
Registered: ‎09-12-2008
My Device: Not Specified

How to Change ButtonFiled Width


   Can any one tell me how can i alter the width of the button field.

   i'm having three buttons all are different size. The size depend on the text on it.

   But is there a way i can make all there button of same size(without writing separate class for the buttons)?




Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to Change ButtonFiled Width

class FixedWidthButtonField extends ButtonField{
private int width;

FixedWidthButtonField( String label, int Width){
super( label);
width = Width;
public int getPreferredWidth(){
return width;

(code by jfisher, his guides are currently offline)
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