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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -