Any ideas for a "scene builder" control?

Werner Lehmann lehmann at media-interactive.de
Fri Apr 5 07:39:15 PDT 2013


I think I may have found a solution. Maybe I needed to write this down 
first to get to the bottom of it...

First of all, any skin-based solution seems to be off the table because 
it does not maintain the container-child parent relationship. The 
contained children will always have the container skin in their parent 
chain.

However, this one seems to do the trick:

@DefaultProperty("items")
class MyContainer extends Region {
   private ObservableList<Node> items = new-observable-list

   MyContainer {
     items.addListener(new ListChangeListener<Node>() {
       ...sync items with Region.getChildren
     }
   }

   ObservableList<Node> getItems() { return items; }
}

Simple enough. Region.getChildren() stays protected and can have extra 
nodes without anybody outside knowing about it.

Thanks...

On 05.04.2013 15:40, Werner Lehmann wrote:
> Maybe it extends Control and lays out the children in a Skin?


More information about the openjfx-dev mailing list