Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Resizing ikons dynamically #156

Open
parszab opened this issue Mar 13, 2023 · 1 comment
Open

Resizing ikons dynamically #156

parszab opened this issue Mar 13, 2023 · 1 comment

Comments

@parszab
Copy link

parszab commented Mar 13, 2023

What would be the preferred was to resize the icons dynamically? E.g. when I have a zoom-in/out button that can change the default font-size with something like this:

applicationPreferences.getFontSizeProperty().addListener((c, o, n) -> {
    borderPane.setStyle(String.format("-fx-font-size: %d; ", n));
});

I would like to also resize the icons with it. The only way I found was to bind the font-size in code:

fontIon.iconSizeProperty().bind(ApplicationPreferences.getInstance().getFontSizeProperty().add(4));

But this creates a lot of error messages:

SEVERE: Could not reset [-fx-icon-size] on [IntegerProperty [bean: fth-printer:19:0xeceff4ff, name: iconSize, bound, value: 19]] due to FontIcon.iconSize : A bound value cannot be set.

Not sure why the iconSize is a property if it cannot be cleanly bound.

I also tried this, which breaks the icons:

applicationPreferences.getFontSizeProperty().addListener((c, o, n) -> {
    fontIcon.setStyle(String.format("-fx-icon-size: %d; ", applicationPreferences.getFontSizeProperty().get()));
});
@aalmiray
Copy link
Collaborator

Related to #150

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants