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

Reply
New Developer
ThomasT
Posts: 6
Registered: ‎12-26-2011
My Device: none/android phone
Accepted Solution

paint() method never called

Hey guys,

 

 

I'm having a problem with the code below:

 

package mypackage;

import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.Graphics;

public class MyApp extends UiApplication
{
    public static void main(String[] args)
    {
        MyApp theApp = new MyApp();       
        theApp.enterEventDispatcher();
    }

    public MyApp()
    {        
        pushScreen(new MyScreen());
    }   
    public void paint(Graphics g) {
    	g.setColor( Color.BLUE );
        g.fillRect(0, 0, 100, 100);

    }
}

The paint() method is never called. I'm new to BlackBerry development, but judging from my Java experience, this should work. I don't see what's wrong with this code.

 

Any help would be much appreciated!

 

Cheers,

 

Thomas

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: paint() method never called

Your paint() method in the code below is simply a local method, since UiApplication does not implement paint().

 

I think that you meant to override the paint() in your screen class, but this is not what you are doing here.  

 

 

New Developer
ThomasT
Posts: 6
Registered: ‎12-26-2011
My Device: none/android phone

Re: paint() method never called

oh thank you so much! It's always the simple things.