How to add an image to a JPanel?

前端 未结 14 1543
陌清茗
陌清茗 2020-11-22 00:01

I have a JPanel to which I\'d like to add JPEG and PNG images that I generate on the fly.

All the examples I\'ve seen so far in the Swing Tutorials, specially in the

14条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 00:51

    You can avoid rolling your own Component subclass completely by using the JXImagePanel class from the free SwingX libraries.

    Download

提交回复
热议问题