SwingTree styles are expected to be side effect free functions.
The JComponent however is mutable and very sensitive to repaints.
Mutating a component in a styler can lead to things like endless repaints
and other bugs which are extremely hard to track...
A developer may want to access the dimensions of a component to perform
rendering in a custom Painter. Unfortunately, the dimensions of a component are
not in "developer pixels"! Instead, they are already scaled to the current UI.scale().
To prevent scaling issues, use ComponentStyleDelegate.componentWidth() and ComponentStyleDelegate.componentHeight(). These are scaled to "developer pixel"
SwingTree styles are expected to be side effect free functions.
The parent of a JComponent however is mutable and very sensitive to repaints.
Mutating a component in a styler can lead to things like endless repaints
and other bugs which are extremely hard to track...
A developer may want to access the dimensions of a component to perform
rendering in a custom Painter. Unfortunately, the dimensions of a parent component are
not in "developer pixels"! Instead, they are already scaled to the current UI.scale().
SwingTree styles are expected to be side effect free functions.
The parent of a JComponent however is mutable and very sensitive to repaints.
Mutating a component in a styler can lead to things like endless repaints
and other bugs which are extremely hard to track...
A developer may want to access the dimensions of a component to perform
rendering in a custom Painter. Unfortunately, the dimensions of a parent component are
not in "developer pixels"! Instead, they are already scaled to the current UI.scale().