Image by CSS and popup size

Jeff Martin jeff at reportmill.com
Sun Mar 2 08:33:11 PST 2014


Recently I had a problem where I wanted to show a popup centered about a node, so I used a little hack to trigger Window's sizing before it became visible:

	popup.setOpacity(0); popup.show(); popup.hide(); popup.setOpacity(1);

I wonder what would happen if you added that line, then did a popup.sizeToScene() before you did the real show?

jeff


On Mar 2, 2014, at 1:42 AM, Tom Eugelink <tbee at tbee.org> wrote:

> 
> 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?
> 
> Tom
> 
> 



More information about the openjfx-dev mailing list