Image by CSS and popup size

Tom Eugelink tbee at
Sat Mar 1 23:42:48 PST 2014

In the datetime textfields in JFXtras, the picker popup has an explicit close button rendered using an ImageView, the image is specified using CSS "-fx-image".
This ImageView is added as the right of a BorderPane, and the BorderPane is the content of a popup.

What happens is that the close image is not shown. I suspect this is because the CSS is applied after the popup is opened, so the ImageView initially has a width of 0. For the moment I enforce a width using setFitWidth(16), but that of course is not the idea of styling via CSS.

Trying to preload the ImageView is not possible, because it is not part of any scene/stage until the popup is shown and therefore its CSS is not applied until then.
Preloading the image is not possible, because it is styled through CSS.

I'm stuck; how do I make sure the popup sizes to the correct width, taking the CSS styled image in account?


More information about the openjfx-dev mailing list