I have custom drawn fields which are focusable. Normally the default focus color is Blue which obviously doesn't match to every theme. So can you give me efficient or non efficient ideas to change the color of the focus? Thanks
views:
372answers:
1
+1
A:
Why don't you use skin or even custom drawing? Also remember to
- check getVisualState() == VISUAL_STATE_FOCUS
- remember to override and supress applyTheme method
class FCheckBoxField extends CheckboxField {
public FCheckBoxField(String label, boolean value) {
super(label, value);
}
protected void paint(Graphics g) {
if (getVisualState() == VISUAL_STATE_FOCUS) {
int c = g.getColor();
g.setColor(Color.CRIMSON);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(c);
}
super.paint(g);
}
protected void applyTheme(Graphics arg0, boolean arg1) {
}
}
Max Gontar
2009-12-11 15:02:13