OnFocus如何在黑莓中更改TextBoxField的边框颜色

时间:2010-07-12 18:26:05

标签: blackberry textbox

我正在使用TextBoxField的以下代码: http://na.blackberry.com/eng/devjournals/resources/journals/jul_2005/creating_textbox_field.jsp

现在我正在尝试在聚焦时更改TextBoxField边框颜色。但无法得到。 需要一些帮助。

谢谢,

1 个答案:

答案 0 :(得分:0)

试试这段代码:

protected void paint(Graphics g) {
    if (isFocus()) {
    super.paint(g);
    g.setColor(Color.BLACK);
    g.drawRect(0, 0, getWidth(), getHeight());
    } else {
        super.paint(g);
        g.setColor(Color.WHITE);
        g.drawRect(0, 0, getWidth(), getHeight());
    }
}
相关问题