This test program is based on a snippet I found on this site, but gives some unusual results. Can someone please correct this or link me to a foolproof method to put images on buttons etc in B4J
That is the expected behaviour. the set graphic method on a node adds the graphic within the target node, thereby stretching the target node to allow it to fit.
If you want to change the background image of the button, use the CSSUtils library.
B4X:
Sub ButtonBOTTOM(BTN As Button)
CSSUtils.SetBackgroundImage(BTN,File.DirAssets,"ButtonBot.PNG")
End Sub
Sub ButtonTOP (BTN As Button)
CSSUtils.SetBackgroundImage(BTN,File.DirAssets,"ButtonTop.PNG")
End Sub
From the Javafx javadoc. Search Google for javafx 8 javadoc. Or 11 if you want that. There is a wealth of information in there. Or search for a specific control. "Javafx 8 Node" for example.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.