Question

Trying to update my application to Java 8, I found that the JavaFX UI became unusable. There are severe validation and repainting issues throughout the screens, and I suspect MigLayout (4.2) to be the culprit, since others seem to suffer from it as well: https://code.google.com/p/miglayout/issues/detail?id=6

I have provided a running example of the issue on github: https://github.com/UrsKR/miglayout-repaint

It illustrates that the issue is triggered when adding Nodes to a MigPane after the initial layout is computed.

How to make the two of them collaborate as with Java 7/JavaFX 2? Are there any documented changes in the way layouts behave in JavaFX 8?

Edit: I have reported a corresponding bug to JavaFX, which they file as a regression. Maybe there is no way of making this behave correctly.

Was it helpful?

Solution

Speaking with developers from MigLayout and JavaFX, I found out that there is no way to make JavaFX 8 and MigLayout 4.2 cooperate.

For the moment, the solution is to update MigLayout to 5.0-SNAPSHOT, available in Sonatype's Snapshot repo.

The reason for this is - as far as I understand it - that JavaFX 8 triggers layouts only once per pulse, instead of multiple times as was the case in JavaFX 2.
MigLayout 4.2 had validation issue, in certain scenarios it updated the screen without updating, although its layout grid was invalid.
Since layouts were triggered multiple times per pulse, the validation (which happened later in the layout pass) was used in a subsequent layout pass, thus rendering the layout correctly.
By switching to the once-per-pulse behaviour, JavaFX 8 exposed this issue in MigLayout, and it was fixed by validating the layout prior to each layout pass.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top