如何将JLabel.getIcon()转换为BufferedImage [英] How to convert JLabel.getIcon() to BufferedImage
问题描述
我有一个仅包含图标的JLabel,我可以通过label1.getIcon()获得该Icon,但是我不知道如何将该Icon转换为BufferedImage.仅供参考,我不是在谈论ImageIcon,而只是在谈论Icon.另外,我在>如何将Icon从JLabel转换为BufferedImage时看到了这个问题. ?,但我似乎无法弄清楚.
I have a JLabel that contains only an icon, and I can get the Icon with label1.getIcon(), but I can't figure out how to convert that Icon into a BufferedImage. Just FYI, I'm not talking about ImageIcon, only Icon. Also, I have seen the question at How to convert Icon from JLabel into BufferedImage?, but I can't seem to figure it out.
与往常一样,任何示例或解释都将不胜感激. 谢谢!
As always, any examples or explanation are much appreciated. Thanks!
推荐答案
由于JLabel.getIcon()
返回 Icon ,因此您要将Icon转换为bufferedImage.我认为您需要
As JLabel.getIcon()
returns a Icon so you want to convert the Icon to bufferedImage.I think you need to view this question.Here you can get the way through which you can convert a icon to BufferedImage
这篇关于如何将JLabel.getIcon()转换为BufferedImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!