Skip to content

Resizing ikons dynamically #156

@parszab

Description

@parszab

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()));
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions