Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Re: Is this possible?

 


JCarty wrote:

Try using paintBackground instead  of paint to draw your bitmap and see how it works out. Usually works for me too. I can't see what's wrong with your code.


 

I just tried that and it doesn't paint the image. It's just a blank screen, but the field shows just fine.

 

Developer
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Is this possible?

[ Edited ]

 

    public void paintBackground(Graphics g)
{
g.drawBitmap(0,0, _backgroundBM.getWidth(), _backgroundBM.getHeight(), _backgroundBM , 0, 0);
}

 

 

Actual code from one of my games that is out right now.

 

In the paint method, all I have are the elements that move.

 

 

public void paint(Graphics g)
{
super.paint(g);

for( int i=0; i<_pieceTotal; i += 6 ) {
_piece[i].draw(g);
_piece[i+1].draw(g);
_piece[i+2].draw(g);
_piece[i+3].draw(g);
_piece[i+4].draw(g);
_piece[i+5].draw(g);
}
}

 

These pieces are painted on top of the background and the elements that I've added to the screen via the standard add.

 

The only difference is I don't have a vertical manager sitting in between them. So maybe you need to add your paint to your HorizontalFieldManager.

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Highlighted
Developer
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Re: Is this possible?

I figured it out, but it was more trial and error then anything.

 

I created a vfm and put the background image in there. I then created a new vfm and added it to the first vfm. After playing around with the paint methods it now works. Thanks for your help.