-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizing Toolbar Can Overflow Without Creating Dropdown #7000
Comments
nbtoolbar-2024-01-25_09.14.59.mp4This video shows it happening. |
Does this happen with an alternative Look and Feel? Be good to know if it's specific to FlatLaf on Windows. |
I can reproduce with Metal and Nimbus as well. It seems that for Metal the affected window width was the same as FlatLaf, but for Nimbus I had to resize the window slightly to see the failure. Once you've seen the failure, then add several more icons, resizing the window causes the toolbar to immediately change to the dropdown. However, if you put the size back to where it was before (at the failing width) then removing an icon can also trigger the failure (icons are hidden off the edge of the screen). 3 people in my company have been able to reproduce this failure all on different machines. |
the overflow mechanism of the toolbar is only updated when the toolbar is resized. This works most of the time since adding/removing buttons does resize the toolbar, unless it is modified when it already overflows. The obvious way of fixing this would be to update the overflow when something is added/removed, but the current implementation rebuilds the whole toolbar when something is added/removed and the overflow mechanism itself adds/removes components too. So this is not going to work. I have a working version which uses invalidate() and rebuilds the toolbar in doLayout() if it is invalid, but I don't like the impl tbh.Toolbars are also used everywhere, there is a risk that this will break something. |
linked a draft PR targeting NB 22 - I think this might work. |
Apache NetBeans version
Apache NetBeans 20
What happened
When using the Customize Toolbars feature, if the Netbeans window is just larger than the existing toolbars, adding a new toolbar button can cause the buttons to overflow out of the window (the right-most buttons are not displayed) rather than converting to a dropdown as they should.
I suspect there is a slight miscalculation somewhere or an event getting lost such that it doesn’t think it needs the overflow dropdown.
Language / Project Type / NetBeans Component
All
How to reproduce
Launch netbeans
Make not fullscreen
Create a new project (I used the default reactjs)
Select View->Toolbars->Use Small Icons
Select View->Toolbars->
<Select all toolbars>
Select View->Toolbars->Customize
Move Performance to the far-right of the toolbar space
Resize the window so it's just wider than the existing toolbar buttons so they all just barely fit.
Add a new icon from the Customize Toolbar window into the Performance toolbar.
At this point the existing far-right button slides off the screen, rather than becoming a dropdown as it should. If it works correctly, remove the icon you just added and slightly adjust the width of the window. Try different widths until it fails. Once you have the right window width it should be reliably reproducible, but only certain widths will fail.
Did this work correctly in an earlier version?
No / Don't know
Operating System
Windows 10 Pro 22H2
JDK
openjdk 17.0.8 2023-07-18
Apache NetBeans packaging
Apache NetBeans binary zip
Anything else
I have been unable to reproduce this problem on Linux. It can be frustrating to reproduce because it will work properly for most window widths, but get it just right and it fails every time.
Are you willing to submit a pull request?
No
The text was updated successfully, but these errors were encountered: