View Single Post
Old 01-09-2009, 11:35 PM   #1
New Member
Join Date: Jan 2007
Location: Chile
Model: 8100
Carrier: Entel PCS
Posts: 14
Exclamation Fixed width button trick not working correctly...

Please Login to Remove!

I have tested the trick given here
BlackBerry Fixed Width ButtonField (also here

... plus adding a Style so can be centered
my idea was to make it 30 pixels less than the screen width
so.. I have this
public class FixedWidthButtonField extends ButtonField{
    private int width;
    FixedWidthButtonField( String label, int Width){
        super( label, ButtonField.FIELD_HCENTER);
        width = Width;
    public int getPreferredWidth(){
        return width;
and in the screen
FixedWidthButtonField _bf = new FixedWidthButtonField("Test", Display.getWidth() - 30);
with this I get the button centered, by the text in it isnīt centered!!

Iīm using JDE 4.5.0
any ideas??

Thanks in advance...
Offline   Reply With Quote