Bug: ToolBar always using overflow menu whenever a scaled resolution set
Andy Goryachev
andy.goryachev at oracle.com
Wed Jul 23 19:30:01 UTC 2025
Do we have the JBS ticket filed for this issue?
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Cormac Redmond <credmond at certak.com>
Date: Tuesday, July 22, 2025 at 12:08
To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: Re: Bug: ToolBar always using overflow menu whenever a scaled resolution set
Any thoughts on this? It seems like a definite JavaFX bug with hopefully a simple fix. Choosing any fractional scaled resolution may or may not cause the issue. I also wonder what other controls may suffer from the same issues.
On Sat 19 Jul 2025, 19:01 Cormac Redmond, <credmond at certak.com<mailto:credmond at certak.com>> wrote:
Hi,
I've traced the bug down to a rounding error. See the below screenshot in ToolBarSkin's getOverflowNodeIndex(double length).
These two numbers are not equal, but should be. snapSizeX() ultimately ends up grabbing getSnapScaleX(), whose value would be 1.25. If it's 1 (i.e., no scaling), we don't see this issue. If it's 1.25, we see this rounding difference between the two numbers in this instance. If these two numbers are not equal, the calling code mistakenly assumes the overflow box is necessary.
[cid:ii_mdajteh84]
Can someone fix this?
Kind Regards,
Cormac
On Sat, 19 Jul 2025 at 18:33, Cormac Redmond <credmond at certak.com<mailto:credmond at certak.com>> wrote:
Confusingly, make the string longer, such as "Create Schema 123 123 123":
bp.setTop(new HBox(new ToolBar(new Button("Create Schema 123 123 123"))));
...and the overflow doesn't appear (but still, anything between and including 13-24, it does):
[cid:ii_mdaiye703]
Kind Regards,
Cormac
On Sat, 19 Jul 2025 at 11:12, Cormac Redmond <credmond at certak.com<mailto:credmond at certak.com>> wrote:
Hi,
There's a bug whenever using a ToolBar on Windows if you set your resolution scale > 100% (which is quite common). E.g., 125%:
[cid:ii_mda2w6ew0]
E.g., this is what a ToolBar always renders if scale is 125%:
[cid:ii_mda2y4u71]
As compared to what you'd expect (scale set to normal/100%):
[cid:ii_mda306hd2]
Very easy to reproduce the above, set your scale to 125% and run this:
public class ToolbarBugApp extends Application {
@Override
public void start(Stage primaryStage) {
BorderPane bp = new BorderPane();
// Wrapping in HBox and using button with 13+ chars causes bug
bp.setTop(new HBox(new ToolBar(new Button("Create Schema")))); // BUG
// bp.setTop(new ToolBar(new Button("Create Schema"))); // NO BUG (no HBox)
// bp.setTop(new HBox(new ToolBar(new Button("Create Schem")))); // NO BUG (12 chars)
primaryStage.setScene(new Scene(bp, 600, 400));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
As per the comments, this bug appears to happen when your ToolBar is wrapped in a HBox and contains a Button that has 13+ characters, for example. This is quite a serious bug, in my opinion.
I believe this is present in JFX 24 and the JFX 25 master branch.
Kind Regards,
Cormac Redmond
Software Engineer, Certak Ltd.
e: credmond at certak.com<mailto:credmond at certak.com> | m: +353 (0) 86 268 2152 | w: www.certak.com<http://www.certak.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250723/3225ec76/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 14011 bytes
Desc: image.png
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250723/3225ec76/image-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6945 bytes
Desc: image.png
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250723/3225ec76/image-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6634 bytes
Desc: image.png
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250723/3225ec76/image-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 5287 bytes
Desc: image.png
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250723/3225ec76/image-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 177920 bytes
Desc: image.png
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250723/3225ec76/image-0009.png>
More information about the openjfx-dev
mailing list