How to set background image in Java?

前端 未结 5 2000
孤城傲影
孤城傲影 2020-12-01 12:27

I am developing a simple platform game using Java using BlueJ as the IDE. Right now I have player/enemy sprites, platforms and other items in the game drawn using polygons a

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 13:13

    Or try this ;)

    try {
      this.setContentPane(
        new JLabel(new ImageIcon(ImageIO.read(new File("your_file.jpeg")))));
    } catch (IOException e) {};
    

提交回复
热议问题