Amrita Stha
Amrita Stha

Reputation: 3327

TextField alignment issue

If the textField is aligned to center, its text goes to right most corner when it is unselected. Just like when it is aligned to right. (tried getUnselectedStyles().setAlignment too, Moreover used parent container with flowlayout, boxlayout, borderlayout etc), Is this a bug here?

public NewForm(Resources res){
       TextField tf = new TextField("Hello");
       tf.getAllStyles().setAlignment(Label.CENTER);
       add(tf);
} 

enter image description here

Upvotes: 1

Views: 64

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

Centering doesn't work for text field or text area. For text area we support it for display purposes but this is problematic when we switch from Java to native editing.

There is no good workaround for this at this time.

Upvotes: 1

Related Questions