BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-14-2011, 07:25 PM   #1 (permalink)
New Member
 
Join Date: Feb 2011
Model: 8350i
PIN: N/A
Carrier: nextel
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default background (easy question)

Please Login to Remove!

I would think the code to change the background of my created app would be fairly simple.

Lets just say I want my background to be the color blue...what code should I input to have my app do this? (i've searched many places and cant get an easy answer) thanks
Offline  
Old 02-15-2011, 07:26 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default Re: background (easy question)

From the javadocs (FullScreen or MainScreen classes)

protected void paintBackground(Graphics graphics)Paint this screen's background.
The system calls this method before painting begins in order to clear this screen's background, initializing your provided graphics context to this screen's extent.

By default, this method simple invokes Graphics.clear(); for more complex handling, you should override this method in extending classes.
Offline  
Old 02-15-2011, 04:29 PM   #3 (permalink)
New Member
 
Join Date: Feb 2011
Model: 8700
PIN: N/A
Carrier: bell
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: background (easy question)

Quote:
Originally Posted by jbstevens View Post
I would think the code to change the background of my created app would be fairly simple.

Lets just say I want my background to be the color blue...what code should I input to have my app do this? (i've searched many places and cant get an easy answer) thanks
You could do something like this.
Add the BackgroundFieldManager to your Screen that implements MainScreen

Override the paint(). then draw a background the color you want and then involke the super. paint() to paint the other crap.

This is one way you could do it. Code isn't so great but it shows you how to do it.


public class BackgroundFieldManager extends VerticalFieldManager {

public BackgroundFieldManager(long style) {
super(style);


}
public void paint(Graphics graphics)
{

graphics.setColor(Color.BLUE) ;
graphics.fillRect(0,0,Display.getWidth(),Display.g etHeight()) ;
super.paint(graphics);
}
Offline  
Old 02-18-2011, 08:25 PM   #4 (permalink)
New Member
 
Join Date: Feb 2011
Model: 8350i
PIN: N/A
Carrier: nextel
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Dougsg38p View Post
From the javadocs (FullScreen or MainScreen classes)

protected void paintBackground(Graphics graphics)Paint this screen's background.
The system calls this method before painting begins in order to clear this screen's background, initializing your provided graphics context to this screen's extent.

By default, this method simple invokes Graphics.clear(); for more complex handling, you should override this method in extending classes.
Posted via BlackBerryForums.com Mobile
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: background (easy question)
Thread Thread Starter Forum Replies Last Post
Easy question about mailboxes ahpAdmin General Legacy Device Discussion 5 10-17-2007 11:10 AM
Easy N00b Question GriffDog General 8300 Series Discussion - Curve 5 09-27-2007 06:16 PM
Easy question about Calendar orionpower General Legacy Device Discussion 1 01-26-2007 03:25 PM
Easy question! island BES Admin Corner 2 01-20-2007 08:46 PM
Easy question, pictures and blackberry mrfreeziexp General BlackBerry Discussion 1 10-04-2006 11:36 PM





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.