MigLayoutJFXtras has classes that enable the use of the well known MigLayout for node positioning and sizing. The approach is two fold:
MigLayout {
constraints: "fill"
content: Text { content: "test"
layoutInfo: MigNodeLayoutInfo {
constraints: "center,grow"
}
}
}
In order to reduce the amount of boilerplate code, some utility methods are available in the MigLayout class reducing the example code to: MigLayout {
constraints: "fill"
content: Text { content: "test"
layoutInfo: nodeConstraints( "center,grow" )
}
}
Or even further to: MigLayout {
constraints: "fill"
content: migNode( Text { content: "test" }, "center,grow" }
}
It also is allowed to use MigLayout's constraint classes thus enabling compile time checking: MigLayout {
constraints: LC{}.fill()
content: migNode( Text { content: "test" }, CC{}.center().grow() }
}
Look in the test directory for some example code. The controls skin in XCalendarPicker uses MigLayout. Known issuesIt is still undefined in JavaFX if a container should monitor changes in the min/pref/max size settings of its children and automatically do a relayout. MigLayout-in-JavaFX currently does not. So therefor it is required to call a requestLayout on the MigLayout or any node higher up to flush changes in the child nodes to the screen.The debug feature of MigLayout is not working in JavaFX. 1887 Views |