Javafx | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Javafx

Hey,any body who can help me to put an image to my button on javafx Image image=new Image(getclass().getResource())…doesn't work

4th Jan 2018, 12:50 PM
Abdu
Abdu - avatar
2 Answers
+ 1
The constructor of Image expects either an InpustStream or a String (URL). Your parameter is neither. You probably missed something in front of .getClass.
4th Jan 2018, 2:10 PM
1of3
1of3 - avatar
0
these might help you import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.StackPane; import javafx.stage.Stage;
4th Jan 2018, 1:21 PM
Lucien
Lucien - avatar