problem with : alignment(label -> Alignment.TopCenter) (SCALA)

hello

I have an issue with the place of components : two components (a label and a button) have not the same behavior in terms of alignment.

here is the code:

package com.example.scalatest3

import vaadin.scala._

class Scalatest3Application extends Application("My first app") {

  var label = new Label
  var bouton = new Button

  def buttonClick() {

    label.value = "it rocks a lot!"

  }

  override def main = new VerticalLayout() {

    width_=(100 percent)
    height_=(100 percent)

    label.value = "it rocks"
    add(label)
    alignment(label -> Alignment.TopCenter)

    bouton.caption = "click me!"
    bouton.clickListeners += buttonClick()
    add(bouton)
    alignment(bouton -> Alignment.TopCenter)

  }

}

and the result is :
1/ the button stays at the center of the window
2/ the label stays at the top left of the window

none has the expected behaviour

thanks

olivier :grin:

Hi,

Label is in Vaadin (and in Scaladin) by default 100% wide so you have set its width to undefined to get it visually aligned correctly in this case.

-Henri