Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextField - show hint before user starts typing text

I am developing an Blackberry application. I want to show a hint text in TextField before user starts typing.when user starts typing it should disappear and when there are 0 characters in TextField it should show up.Has anybody implemented this yet?then please share.

like image 964
Dhruv Mevada Avatar asked Dec 13 '22 12:12

Dhruv Mevada


1 Answers

protected void paint(Graphics g) 
{
    if(super.getText().length() == 0)
    {
        g.setColor(Color.GRAY);
        g.drawText("MMYY", 0, 0);
    }
    g.setColor(Color.BLACK);
    super.paint(g);
};
like image 192
Dhiral Pandya Avatar answered Jan 30 '23 13:01

Dhiral Pandya