How to add a custom image to a textfield in blackberry?

661 views Asked by At

Trying to add a background image to a textfield but when a user types over and goes into a horizontal scroll the image seems to be replicated over causing it to look like the following: enter image description here

Basically i want the 1st textfield to look like the 2nd after the user has inputed a large value. I have a class that extends horizontalfieldManager and in my paint function is the following:

protected void paint(Graphics g)
{
    g.clear();
    if (mLabelMode)
    {
        g.setColor(mLabelColor);
    }
    else
    {
        g.setColor(mColor);
    }

    int x = this.getHorizontalScroll();

    g.drawImage(x, 0, mBackground.getWidth(), mBackground.getHeight(), mBackground, 0, 0, 0);

    super.paint(g);
}

Any help would be greatly appreciated.

1

There are 1 answers

0
Swati On