04-03-2009 12:54 PM - edited 04-03-2009 01:04 PM
You can not change the selection color.
This selection is same on emulators i.e blue but on device it can differs from pink to blue to yellow plus I guess it depends upon the theme
set on phone.
You can do one thing you can override the paint of that particular component and change the focus color.
May be this will help you.
04-06-2009 08:06 AM
Yes you can change the default selection color in listField and that to without overriding paint method.
As I found out in other thread related to ListField.
Here is the link of that thread
just include <listField instance>.invalidate(<index>);
as the last line of your drawListRow().
This will help you in changing the color of selection in listField.
04-06-2009 12:49 PM - edited 04-06-2009 12:51 PM
Allow me to take this a step further. You can mimic the way it is done natively at the java layer. It will be a bit slower, but it is not noticable. Check it out:
protected void drawFocus( Graphics g, boolean on )
XYRect focusRect = new XYRect();
getFocusRect( focusRect );
int yOffset = 0;
if ( isSelecting() )
yOffset = focusRect.height >> 1;
focusRect.height = yOffset;
focusRect.y += yOffset;
g.pushRegion( focusRect.x, focusRect.y, focusRect.width, focusRect.height, -focusRect.x, -focusRect.y );
g.setBackgroundColor( YOUR_DESIRED_COLOR );
g.setColor( 0xFFFFFF );
this.paint( g );
*Note: Sometimes this editor butchers my code inserts. Will edit if it looks bad.
Yep it messed up the code insert. Does anyone know why? Maybe it doesn't like the newlines from the JDE?