Search code examples
java-melwuit

How to make Label's text centered vertically?


I tried one by one each of these methods : setting the BgAlign property to CENTER in the Resource Editor , myLabel.getStyle().setBackgroundAlignment(Style.BACKGROUND_IMAGE_ALIGN_CENTER); but the text of the Label is not centered vertically.

So how to make Label's text centered vertically ?

The following image shows the actual alignement of the Label's text :

enter image description here


Solution

  • Label vertical alignment is unsupported only its positioning in relation to an icon.

    As far as I recall you are using FlowLayout for every entry which does support vertical alignment see FlowLayout.setValign(Component.CENTER).