I was playing with the Netflix Clone App that was in one of the Codenameone Tutorials. I noticed in the simulator, the "Netflix" image title was not centered as expected according to the video:
The code that is supposed to display the title is:
((Label)tb.getTitleComponent()).setIcon(r.getImage("netflix-logo.png"));
After invoking a deprecated method setAlignment:
Label title = (Label)tb.getTitleComponent();
title.setAlignment(Component.CENTER);
Now the title is displayed properly in the simulator:
Since the example was done a few years ago, can anyone tell me which is the correct way of centering an image title in the Toolbar?
Thanks.


I'm looking at the code right now and can't find
setAlignmentthere.I don't think I would have used it. The right way to center a title is
tb.setTitleCentered(true);.