Skip to content

Conversation

@neilcsmith-net
Copy link
Member

Ensure the animation layer paint is called at least once inside paintComponent so that the animation timer is shut down.

This is a minimal fix for #9060. If a change is made that triggers no change in bounds, then animation was set to false. However, if an existing animation was active at that time, the animation layer timer isn't stopped because animLayer.paint(..) isn't called during repaint. This causes a doom loop of repaint requests with excessive CPU usage.

This whole animation layer code is a little suspect - ideally it would exit cleanly during the timer listener - but it doesn't seem worth doing a full refactor for a little used feature.

Fixes #9060

Ensure the animation layer paint is called at least once inside
paintComponent so that the animation timer is shut down.
@neilcsmith-net neilcsmith-net added this to the NB29 milestone Dec 4, 2025
@neilcsmith-net neilcsmith-net requested a review from mbien December 4, 2025 11:47
@neilcsmith-net neilcsmith-net added kind:bug Bug report or fix FormDesigner GUI builder, also known as Matisse ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Dec 4, 2025
Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should work I think. I was a little worried about all those if (phase == 1f) checks but it should be 1f still.

@neilcsmith-net
Copy link
Member Author

Yes, there is much that is questionable in that animation layer, but I didn't want to do a lot of refactoring. The phase seems to always be set by a constant. Considered changing to if (phase >= 1f) at https://github.com/neilcsmith-net/netbeans/blob/master/java/form/src/org/netbeans/modules/form/layoutsupport/griddesigner/AnimationLayer.java#L288 Can still do that, or merge as is?

@mbien
Copy link
Member

mbien commented Dec 9, 2025

i think its fine to be merged as is since the rendering code in updatePhase() has phase = Math.min(Math.max(0,phase), 1f); as last statement.

The only place which resets the phase to 0 is the if block above your change.

@neilcsmith-net
Copy link
Member Author

Thanks, same analysis as me. OK, merging.

@neilcsmith-net neilcsmith-net merged commit 3759cc5 into apache:master Dec 9, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) FormDesigner GUI builder, also known as Matisse kind:bug Bug report or fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing insets in GridBagLayout GUI designer leads to permanent high CPU load

2 participants