JPanel not showing background image

后端 未结 2 1713
野趣味
野趣味 2021-01-22 19:27

It is very simple program and i have tried my best but the JPanel doesn\'t come up with a background image. I just want a simple background image on my panel.

Here is my

2条回答
  •  礼貌的吻别
    2021-01-22 20:19

    Don't use a JPanel. Just use a JLabel with an Icon then you don't need custom code.

    See Background Panel for more information as well as a solution that will paint the image on a JPanel with 3 different painting options:

    1. scaled
    2. tiled
    3. actual

提交回复
热议问题