How to add a custom image to a textfield in blackberry?
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:
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
精彩评论