Welcome!

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

Reply
Forums Advisor I
vaishali28
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

problm in custom button field

[ Edited ]


I have made a custom button and now i have to add the text in the middle bt by default it starts from the left.code is

public CustomButton(String text,int background,int foreground)
{
this.text=text;
this.background=background;
this.foreground=foreground;
}
.........
so i want that the text in the butonfieldstarts from the center..
can anyone help me...??
Thanks in advance..

Please use plain text.
Developer
simon_hain
Posts: 15,956
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: problm in custom button field

try different styles, like HCENTER or FIELD_HCENTER etc
----------------------------------------------------------
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
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: problem in custom button field

As suggested elsewhere, if you want a more accurate answer, then you will need to include more detail from your CustomButton - the code you have supplied is not helpful in determining what changes might resolve your problem. 

Please use plain text.
Regular Contributor
spardhan
Posts: 64
Registered: ‎01-27-2011
My Device: Not Specified

Re: problm in custom button field

You may need to override the layout method or perhaps just the paint method. Perhaps this link might help you find the solution that works for you.

 

http://supportforums.blackberry.com/t5/Java-Development/Implement-advanced-buttons-fields-and-manage...

 

The Vertical Button Set sample was useful to me when I was implementing a custom button.

Please use plain text.