HeaderBar non-draggable window issue

Cormac Redmond credmond at certak.com
Wed Dec 31 00:22:19 UTC 2025


Hi,

Sometimes I use a ControlsFx MaskerPane as a "please wait" screen whereby I
do not want to allow any interactions with any controls (including Menus in
the HeaderBar if they exist, for example).

I've created a simple dependency-less example to demonstrate something
similar, and the problem.

When a "masker" is on (StackPane visible), I've noticed that a
HeaderBar's window icons are still responsive to mouse events, however, *the
stage cannot be dragged*. This to me suggests different handling/priority
re: mouse events.

This is unintuitive behaviour to the standard user and it is a very
noticeable issue for long-lived blocking tasks (for example) where the user
might need to move a blocked window out of the way. I think if the user can
resize, restore, minimise, etc., which they can -- then they should also be
able to drag the window despite a StackPane sitting on top of it.
HeaderBar.setDragType() doesn't help here.


[image: drag_issue.gif]


Code to reproduce:

public class DraggableHeaderIssue extends Application {
    public static void main(String[] args) { launch(args); }

    @Override
    public void start(Stage primaryStage) {

        // Create a masker pane
        Button closeBtn = new Button("Close");
        StackPane masker = new StackPane(closeBtn);

        HeaderBar.setDragType(masker, HeaderDragType.DRAGGABLE); // Makes
no difference
        masker.setAlignment(Pos.CENTER);
        masker.setStyle("-fx-background-color: rgba(0, 0, 0, 0.75);");
        masker.setVisible(false);
        closeBtn.setOnAction(_ -> masker.setVisible(false));

        Button onButton = new Button("Masker On");
        onButton.setOnAction(_ -> masker.setVisible(true));

        // Create a standard BorderPane with HeaderBar
        BorderPane mainContent = new BorderPane(new StackPane(new
Label("Some sample body")), new HeaderBar(), null, onButton, null);
        mainContent.setPadding(new Insets(10));

        primaryStage.initStyle(StageStyle.EXTENDED);

        // Set the scene with the main content and masker inside a StackPane
        primaryStage.setScene(new Scene(new StackPane(mainContent, masker),
300, 500));
        primaryStage.show();
    }
}


Real example (cannot drag):

[image: drag_headerbar.gif]




Kind Regards,
Cormac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20251231/97e10361/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drag_headerbar.gif
Type: image/gif
Size: 627022 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20251231/97e10361/drag_headerbar-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drag_issue.gif
Type: image/gif
Size: 94710 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20251231/97e10361/drag_issue-0001.gif>


More information about the openjfx-dev mailing list