views:

56

answers:

1

Using JRE 5.0.0, simulator device is an 8520.

On a screen I am using a FlowFieldManager(Manager.VERTICAL_SCROLL) and adding Fields to it to show data.

When I do

this.flowManager = new FlowFieldManager(Manager.VERTICAL_SCROLL);
Field field = new Field()
{
    protected void paint(Graphics graphics)
    {
        graphics.drawTest("Test", 0, 0);
    }
    protected void layout(int width, int height)
    {
        this.setExtend(300, 300); // just testing
    }
}

this.flowManager.add(field);

The screen renders correctly and 'Test' appears on the screen.

If, on the other hand, I try and abstract this into a class called CustomField with the same properties and add it to the flow manager the render will not happen. Debugging shows that the device enters into the Object, into the layout function, but not the paint function.

I can't figure out why the paint function is not called when I extend Field. The 4.5 API says that layout and paint are the only functions that I really need to extend. (getPreferredWidth and getPreferredHeight will be used to calculate screen sizes etc.)

Thanks in advance.

+1  A: 

If at the time of paint a Field is outside the clipping region, it will not be instructed to paint. That's really the only thing that I can see wrong with this.

So make sure you don't have this Field scrolled off the screen somewhere.

Bradley
Thanks, that was it. Too high.
jlindenbaum