Adding an image to a JPanel background

后端 未结 2 588
有刺的猬
有刺的猬 2021-01-22 12:00

How can I add an image to a JPanel background. The image will not be scaled or resized. Thanks.

2条回答
  •  Happy的楠姐
    2021-01-22 13:03

    You can override one of these methods:

    JComponent.paint(Graphics g)
    JComponent.paintComponent(Graphics g)
    

提交回复
热议问题