3

i am new to JavaFX and tornadofx, and now i need to create some highly customized UI components(including submit button, text input field, password input field, datetime picker, dropdown selector etc) shown as the picture bellow:

enter image description here

so, what is the best practice for creating these components? my question includes:

  1. which super class my customized UI component should extend?
  2. is there any existing example in tornadofx?
  3. can i use bootstrap in my case? and if yes, how can i use bootstrap?

thanks (this question also posted here: https://github.com/edvin/tornadofx/issues/498)

Ace.Yin
  • 845
  • 2
  • 9
  • 19
  • Regarding the bootstrap related portion of your question, see: [Bootstrap with JavaFX](https://stackoverflow.com/questions/21268062/bootstrap-with-javafx). – jewelsea Oct 17 '17 at 21:43
  • @jewelsea thanks for your suggestion, i will try later:) – Ace.Yin Oct 18 '17 at 00:55

1 Answers1

5

There really isn't anything TornadoFX specific to this process, but I have two recommendations:

Don't create a custom control unless you really need to. To add custom functionality to a Button or a TextField, install a custom skin instead.

If you really need a custom control, consider extending the Control class. For more layout centric components you might extend a layout instead, or simply Pane.

To learn more about custom components, consider reading this brilliant book:

https://www.amazon.com/Mastering-JavaFX-Controls-Oracle-Press-ebook/dp/B00L3TF02K

Also check out these videos:

https://www.youtube.com/watch?v=L9xtOhdSx6k

https://www.youtube.com/watch?v=7PPcM0E5yQw

Edvin Syse
  • 7,267
  • 18
  • 24