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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 326
Registered: ‎02-02-2009
My Device: Not Specified

Re: change text of LabelField

what i have to code inside  onfocus() and ouunfocus() methods

i cant use setColor() because labelfield does not contains it

please give me hints

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

Re: change text of LabelField

extend the field. implement an int value for the color you want to have. in onFocus set the value to a color, in onUnfocus set the value to another color. In paint you call setColor with the int value.
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
Posts: 326
Registered: ‎02-02-2009
My Device: Not Specified

Re: change text of LabelField

link = new LabelField(xLabel, FOCUSABLE){
            int color = Color.BLUE;
            protected boolean navigationClick(int status, int time){
                UiApplication.getUiApplication().pushScreen(new screen());
                return true;
            protected void paint(Graphics graphics){
                graphics.setFont(Font.getDefault().derive(Font.PLAIN | Font.UNDERLINED,8,Ui.UNITS_pt));
            protected void onFocus(int direction){
                color = Color.WHITE;
            protected void onUnfocus(){
                color = Color.BLUE;

first time link will be blue, after getting focus it become white. but afterlossing focus it is not turnig to blue it still white so cant see the link

what i have make change in this code

Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: change text of LabelField

Add invalidate in onFocus() and onUnfocus() method.

protected void onFocus(int direction) { color = Color.WHITE; invalidate(); } protected void onUnfocus() { color = Color.BLUE; invalidate(); }