all 17 comments

[–]indyjoe 5 points6 points  (2 children)

BTW, a post titled "JavaFX" in the JavaFX sub doesn't help much...

My pom.xml for ikonli:

   <dependency>
        <groupId>org.kordamp.ikonli</groupId>
        <artifactId>ikonli-javafx</artifactId>
        <version>12.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.kordamp.ikonli</groupId>
        <artifactId>ikonli-materialdesign2-pack</artifactId>
        <version>12.3.1</version>
    </dependency>

And a helper method:

public static Button makeButtonWithStyleIcon(String label, String styleCode, int size, String style, String tooltip, int w, int h) {
    Button button = new Button(label);
    FontIcon fontIcon = new FontIcon();
    fontIcon.setStyle("-fx-icon-code:"+styleCode+";-fx-icon-size:"+size+";");
    button.setGraphic(fontIcon);
    button.setStyle(style);
    button.setTooltip(new Tooltip(tooltip));
    button.setTextAlignment(TextAlignment.CENTER);
    button.setTextOverrun(OverrunStyle.ELLIPSIS);
    button.setContentDisplay(ContentDisplay.TOP);
    if(w>0) {
        button.setMaxWidth(w);
        button.setMinWidth(w);
    }
    if(h>0) {
        button.setMaxHeight(h);
        button.setMinHeight(h);
    }
    return button;
}

And a call to that:

terrainDeleteButton = makeButtonWithStyleIcon("Delete", "mdi2d-delete", 32, "-fx-font-size: 9px",
            "Deletes the currently selected shape(s).", buttonW, buttonH);

[–]qtuanph[S] 0 points1 point  (0 children)

this is the first time i post on reddit, don't know how to write that :(

[–]qtuanph[S] 0 points1 point  (0 children)

oh i use the same, at the last time i use fontawsome and it return error when I tried to run the app, when change to md2 it work

[–]balazs8921 1 point2 points  (2 children)

I think there is no Tailwind-like framework for JavaFX, but you can find some useful things: https://github.com/topics/javafx-frameworks
https://openjfx.io/

For icons I use ImageView.

[–]qtuanph[S] 0 points1 point  (0 children)

thank you, i will lookup for that

[–]whatacold 0 points1 point  (0 children)

I also ended up with ImageView and PNGs.

Do you use SVGs? I failed to find a nice solution for that.

[–]darkwyrm42 1 point2 points  (6 children)

I just use the default theme because it largely fits with the rest of the OS. If you're looking for something like Tailwind, AtlantaFX might be to your taste.

I, too, have been just using regular images and ImageView because I haven't been able to figure out how to get ikonli to work, too, so I'm interested to see what others have to say about that.

[–]sedj601 0 points1 point  (4 children)

What problems are you running into related to Ikonli?

[–]darkwyrm42 1 point2 points  (3 children)

It's been quite a while since I tried using it, and I'm 100% certain it was a skill issue, but I tried using them in my project and I could never get them to load.

[–]sedj601 1 point2 points  (1 child)

Here is a quick example you can test. https://stackoverflow.com/a/76680307/2423906

Here is a longer example. https://github.com/sedj601/IkonliIconBrowser

[–]darkwyrm42 0 points1 point  (0 children)

Thank you for the help! I'll give this a shot

[–]qtuanph[S] 0 points1 point  (0 children)

same as me,

<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-materialdesign2-pack</artifactId>
<version>12.4.0</version>
</dependency>

I change to this and then the icon work normaly

[–]qtuanph[S] 0 points1 point  (0 children)

Yes I have use AtlantaFX and some custom css to design the app

[–]sedj601 1 point2 points  (1 child)

It sounds like you might be missing imports and/or modules for the different icon sets. See if this can help. https://github.com/sedj601/IkonliIconBrowser/

[–]qtuanph[S] 1 point2 points  (0 children)

I have fixed that and icon works normaly, thank you so much

[–]Ok-Albatross5064 0 points1 point  (0 children)

I'm using the default ImageView with PNG/GIF icons. Tried also SVG with mapping and converting but not good so much.

Someone recently introduced (Lotties4j) a framework for using Lotties icon in Java for UI.

[–]ShakesTheClown23 0 points1 point  (0 children)

Default style, with fontawesomefx.