Dear Pavel:

Sorry, the reproducer provided in the ticket made no sense: multiple default 
buttons within the same window serve no purpose.

At the API level, the Javadoc for the defaultButton property says


* A default Button is the button that receives

* a keyboard VK_ENTER press, if no other node in the scene consumes it.

The way I read it is one the top button receives the event it gets consumed, so 
you can't expect multiple buttons to receive that event.

The functionality you are suggesting seems like a custom application specific 
requirement, and putting accessibility issues mentioned by David earlier aside, 
should be handled by the application - you do have public APIs available 
(addEventHandler, addEventFilter).

Cheers,
-andy


P.S. thank you David for responding to the original message earlier!



From: PavelTurk <[email protected]>
Date: Tuesday, June 2, 2026 at 07:54
To: [email protected] <[email protected]>
Subject: [External] : About JDK-8385779

Hello everyone,

I opened bug report JDK-8385779 "Multiple default buttons in one scene:
only the last-added one responds to Enter" but it was closed
because  "There should be only one default button".

I don't agree with it. These are two real examples:

1. Split-pane UI (IDE-style): each pane has its own primary action
(e.g., Search vs Apply), so multiple contextual default buttons exist
but only the focused pane’s default is active at any time.
2. Inline modal dialogs: a secondary error dialog with its own default
button appears over a primary input dialog, and after dismissing the
error dialog the original dialog’s default action may already be stale
or inactive.

So, I suggest to reopen the issue.

Best regards, Pavel

Reply via email to