Skip to content

Styleable translation of scaled icons#1067

Open
daWoife wants to merge 3 commits intoJFormDesigner:mainfrom
daWoife:main
Open

Styleable translation of scaled icons#1067
daWoife wants to merge 3 commits intoJFormDesigner:mainfrom
daWoife:main

Conversation

@daWoife
Copy link
Contributor

@daWoife daWoife commented Dec 9, 2025

Since the last release 3.7 it is possible to scale an icon derived from FlatAbstractIcon by setting the style 'icon.scale' in the client properties of the icons component.
With this change it is also possible to translate the scaled icon by setting the styles 'icon.xOffset' and icon.yOffset'.
This can be useful to layout a scaled icon inside a component like a checkbox or radiobutton.

image

The checkboxes and the radiobuttons are scaled by 20 percent, the checkboxes are set down by one pixel.

checkbox.setClientProperty("FlatLaf.style", "icon.scale:1.2;icon.yOffset:1");

Added xOffset and yOffset properties for icon translation.
Adjust translation of graphics context to be done before scaling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant