3

In my Vaadin8 app, I'd like the UI to alternate between two labels. That is to say, in the same spot on the screen, show a label for 5 seconds and then switch to the other one, show that for another 5 secs, switch back and so on. What would be a good way to implement this?

Eight Rice
  • 816
  • 7
  • 24

2 Answers2

4

If the data to be shown is static, i.e. just two alternating values of label, then the best option is to implement this as custom component. As this is quite simple case for such, I made it and published in Vaadin's Direcotry

https://vaadin.com/directory/component/switchinglabel

The source code is in GitHub repository here

https://github.com/TatuLund/SwitchingLabel

Another alternative would be to have timed thread and use Push to set new value of Label periodically.

Tatu Lund
  • 9,949
  • 1
  • 12
  • 26
0

I would manipulate it with javascript using Vaadin's JavascriptComponent