开发者

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

开发者 https://www.devze.com 2023-02-18 09:12 出处:网络
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:

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:

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

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 f开发者_Go百科unction 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.


have a look at this:

Using image for a TextEditField in Blackberry

0

精彩评论

暂无评论...
验证码 换一张
取 消