@daniloprates data is not a property that you can set through this call, but directly:
for(i = 0; i < 5; i++)
{
var p = Content.addPanel("P"+i, i * 100, 0);
p.data.index = i;
p.setPaintRoutine(function(g)
{
g.setColour(Colours.white);
g.drawAlignedText(this.data.index, this.getLocalBounds(0), "centred");
});
};