0

While exploring the basic concepts of JavaFX, the following question arose:

Is there a way to customize the layout of composite controls (such as TreeView or Accordion)?

For example, to achieve a horizontal arrangement of child elements or to introduce animations.

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106

1 Answers1

1

Some controls include API for controlling their layout. For example, you can set the orientation of a ListView to Horizontal or Vertical or switch animation on or off in a TitledPane.

You can write your own skins to apply to existing controls and modify their layout.
Public API for control skinning is provided in Java 8. Use the -fx-skin attribute to change a skin via css. More details are in the JavaFX wiki control skinning section.

Using custom skins you can completely change the layout and animations for a control. See for instance this carousel skin of a TreeView.

jewelsea
  • 150,031
  • 14
  • 366
  • 406
  • Thanks for the detailed answer. The links you have provided should help me getting started. But first I should try to upgrade my tools to be ready for Java 8. – Jens Piegsa Oct 20 '13 at 08:02
  • The layout of a horizontal tree is a little bit more difficult than the standard TreeView layout. In my case, I only see the option to go through the entire tree twice to realize the full layout. This, however doesn't seem to go well with the virtualization concept introduced by `VirtualFlow`. It may be easier to achieve my layout requirements with something like, let's say a `TreePane`. – Jens Piegsa Oct 23 '13 at 00:46