Deprecated API
Contents
-
Deprecated Classes
-
Deprecated MethodsMethodDescriptionUse
AbstractDelegate.setMaxSize(Size)instead!UseAbstractDelegate.setMinSize(Size)instead!UseAbstractDelegate.setPrefSize(Size)instead of this method.UseAbstractDelegate.setSize(Size)instead of this method!because it introduces the following two issues:
-
SwingTree styles are expected to be side effect free functions.
The
JComponenthowever 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 currentUI.scale(). To prevent scaling issues, useComponentStyleDelegate.componentWidth()andComponentStyleDelegate.componentHeight()for the current size, orComponentStyleDelegate.componentPrefWidth()andComponentStyleDelegate.componentPrefHeight()for the preferred size. These are all scaled down to "developer pixel". This matters in particular when the size you read here is fed back into the styling API (e.g.ComponentStyleDelegate.minHeight(double)orComponentStyleDelegate.maxHeight(double)), because those methods scale their inputs up again. Readingcomponent().getPreferredSize()directly and passing it back in would scale the value twice.
because it introduces the following two issues:
-
SwingTree styles are expected to be side effect free functions.
The parent of a
JComponenthowever 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 currentUI.scale().
because it introduces the following two issues:
-
SwingTree styles are expected to be side effect free functions.
The parent of a
JComponenthowever 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 currentUI.scale().
-
SwingTree styles are expected to be side effect free functions.
The