R rodmcm Active Member Licensed User Longtime User Aug 10, 2022 #1 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 Attachments B4J Buttons_Test.zip B4J Buttons_Test.zip 3.5 KB · Views: 268
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
stevel05 Expert Licensed User Longtime User Aug 10, 2022 #2 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: Copy 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 Last edited: Aug 10, 2022 Upvote 0
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: Copy 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
R rodmcm Active Member Licensed User Longtime User Aug 11, 2022 #3 Thanks for that. Where did you learn about the setgraphic actions? I would like to expand my learning Upvote 0
Thanks for that. Where did you learn about the setgraphic actions? I would like to expand my learning
stevel05 Expert Licensed User Longtime User Aug 11, 2022 #4 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. Upvote 0
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.
R rodmcm Active Member Licensed User Longtime User Aug 12, 2022 #5 Thanks for that... I have never learnt Java... perhaps now time to start Upvote 0