javafx - Set Graphic to label -
i want set label graphic. tested code:
private static final imageview liveperformicon; static { liveperformicon = new imageview(mainapp.class.getresource("/images/flex.jpg").toexternalform()); } final label label = new label(); label.setstyle("-fx-background-image: url(\"/images/flex.jpg\");"); liveperformicon.setfitheight(20); liveperformicon.setfitwidth(20); label.setgraphic(liveperformicon);
but don't see image.
the way found make work this:
label.setstyle("-fx-background-image: url(\"/images/flex.jpg\");");
is there way solve this?
not sure, afaik controls should created on javafx application thread, you're creating imageview in static initializer, i'm not sure if it's executed on application thread.
besides: want liveperformicon static???
Comments
Post a Comment