I have some code like so that I was hoping each text line to be centered (instead it was left justified). (I just downloaded latest upgrade of codenameone and intellij yesterday and am starting to play with codenameone). I meant to a long time ago and got distracted.
super("MyApp", BoxLayout.y());
add(new Label("Welcome to the world"));
add(new Label("of"));
add(new Label("Games"));
Here is a picture from the codenameone simulator...
I tried to tweak the very first label to this
Label label1 = new Label("Welcome to the world");
label1.setTextPosition(Component.CENTER);
add(label1);
but that throws an Exception "Text position can't be set to 4". I tried a Container with BorderLayout after that doing an addComponent(BorderLayout.CENTER, new Label("Welcome")) but that ended up left justified as well.
Any ideas how to fix this to be centered?
EDIT: I found a deprecated label.setAlignment method. That fixes the alignment to be centered. Is this maybe a bug in the latest release?
thanks, Dean
