09-30-2010 01:57 AM
Hi
I have one button which in left allignment and i have given the label as signin and it shows in very small size, can anyone tell me how to increase the size of that button?? I want it to be displayed in very large size.
09-30-2010 02:12 AM
I suggest you CustomButtonField.
Use the Search Button, You will find many Solution and threads releted to your thread.
--------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.
09-30-2010 02:14 AM - edited 09-30-2010 02:17 AM
Override the getPreferredWidth and getPreferredHeight function of the ButtonField as follows:
ButtonField cButton = new ButtonField("Signin", ButtonField.CONSUME_CLICK) {
public int getPreferredWidth()
{
int fieldWidth = 100; //required width
return fieldWidth;
}
public int getPreferredHeight()
{
int fieldHeight = 20; // required height
return fieldHeight;
}
};
Hope it Helps....
09-30-2010 02:18 AM
Thank you both guys
09-30-2010 02:29 AM
Hi,
Create a custom class extending the field you want to modify and override getPrefferedWidth, then return the size you want in pixels.
class MyButtonField extends ButtonField
{
private int width;
MyButtonField( String label, int Width)
{ super( label);
width = Width;
}
public int getPreferredWidth()
{ return width;
}
}
Instantiate the Button like this
private MyButtonField btnB1 = new MyButtonField( "Test", 100);
Height can also be changed like this
09-30-2010 02:51 AM
Thank you for your solution
09-30-2010 02:52 AM
Please mark the thread solved if you have got the solution...