BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-17-2007, 07:08 AM   #1 (permalink)
New Member
 
Join Date: May 2007
Model: 8703
PIN: N/A
Carrier: -
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post Colored Label

Please Login to Remove!

Hi,

I wanna know if it is possible to change the LABEL color of a EditField. In other words, if it is possible to change the color of the first parameter received by the EditField constructor.

Thank's a lot!
Offline  
Old 05-30-2007, 07:28 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default my way

I had this problem soon...I did it as write my own class ColoredLabel extends Field or LabelField (depends on what do you need) and paint a label with specified color....here is a part of the code:

public void paint(Graphics g) {
g.setFont(font);
g.setColor(Color.BLUE);
g.drawText(label, 0, 0);
}
}

it is easy that way
Offline  
Old 05-31-2007, 12:36 PM   #3 (permalink)
New Member
 
Join Date: May 2007
Model: 8703
PIN: N/A
Carrier: -
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi pa4o85, thanks for reply.

I actually done a solution very similiar to yours: I created a custom class that extends from EditField, and then I made an override operation (paint(Graphics g)).

However, the problem is: inside the paint method, if I set the graphics object color (g.setColor(Color.BLUE), for example), ALL the text written at the EditField will be blue (in this case).

I need to paint just a PART of the text (the label one).

Do you have any ideas on how to perform that??

Thank´s a lot! Regards!
Offline  
Old 06-01-2007, 02:46 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, well you mean you want to create an custom object contains edit field and label...I understand it that way...so paint the label with the specified color and paint next to it the edit field...i hope this will help...i'm programming for BlackBerry from less than a month,so i'm learning a lot of things now...maybe i am not the right person who can give you the best ideas)
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2014 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.