HeaderBar (preview) clipped out of window during resize
Michael Strauß
michaelstrau2 at gmail.com
Tue Jun 24 18:00:16 UTC 2025
We had a brief discussion back in October 2024 whether HeaderBar
should be a normal layout container in the scene graph, or whether it
should live somewhere else (for example something like
Scene.setHeaderBar(), analogous to Scene.setRoot()). It became clear
that we wanted HeaderBar to be a part of the scene graph, because its
capability to interact with the rest of the scene graph is one of the
main features.
This naturally exposes HeaderBar to the same question that the rest of
the scene graph has to solve: what to do in case of an overconstrained
layout? Layout containers have different (but well-specified) answers
for this question. In your example, you're using a StackPane as the
root layout container. By default, StackPane will center its content
if it can't be resized to fit the available space. This behavior can
be adjusted with the StackPane.alignment property: set to TOP_LEFT,
the HeaderBar in your example will stay where it is.
The way I see it, there's an easy solution: use the scene graph the
way it's designed and meant to be used. If ControlsFX wraps the scene
root in a StackPane, but doesn't set the content alignment to
TOP_LEFT, then that's a bug in ControlsFX because it changes the way
the scene graph is laid out.
More information about the openjfx-dev
mailing list