Cannot load image in JavaFX

前端 未结 5 617
离开以前
离开以前 2020-11-28 12:49

I tested this code in order to create dialog with image.

final int xSize = 400;
final int ySize = 280;
final Color backgroundColor = Color.WHITE;
final Strin         


        
5条回答
  •  半阙折子戏
    2020-11-28 13:33

    copy and paste the image into folder where source package(source packages in NetBeans IDE) is present. Then

    Image image = new Image("a1.jpg");
    Image image = new Image("File:a1.jpg");
    

    both will work.

提交回复
热议问题