Reputation: 773
The default highlight color in blackberry is blue. I'm currently doing an application which dominant color is red. Is there a way to change the highlighter color to red? I googled it and find a solution for the ListField, how about for other fields like buttons, textFields, bitmapFields etc...?
Upvotes: 1
Views: 198
Reputation: 773
Found this implementation in the blackberry forum, have tried it and it works perfectly. But you need to override this method for each fields that you want to have a different highlighter.
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 color here*/);
g.setColor( 0xFFFFFF );
g.clear();
this.paint( g );
g.popContext();
}
Upvotes: 3
Reputation: 28168
You can override Field.drawFocus
for your custom fields:
protected void drawFocus(Graphics g, boolean on) {
// Custom focus painting
}
Upvotes: 2