[英]How to add images icon in the title bar of JFrame?
我需要在JFrame
标题栏中添加图像,有人可以告诉我这样做的方法吗?
You could use Window#setImageIcons(List<Image>)
which allows you to supply a series of different sized, which allows the underlying platform to choose a icon that is best suited to the platform and look and feel... 您可以使用
Window#setImageIcons(List<Image>)
来提供一系列不同的大小,从而允许基础平台选择最适合该平台以及外观的图标。
List<Image> images = new ArrayList<Image>(4);
images.add(ImageIO.read(getClass().getResource("/icons/icon16x16.png"));
images.add(ImageIO.read(getClass().getResource("/icons/icon24x24.png"));
images.add(ImageIO.read(getClass().getResource("/icons/icon32x32.png"));
images.add(ImageIO.read(getClass().getResource("/icons/icon48x48.png"));
frame.setImageIcons(images);
use frame.setIconImage(Image image)
see http://docs.oracle.com/javase/6/docs/api/javax/swing/JFrame.html for details. 使用
frame.setIconImage(Image image)
有关详细信息,请参见http://docs.oracle.com/javase/6/docs/api/javax/swing/JFrame.html 。 Use BufferedImage
to represent your image. 使用
BufferedImage
表示您的图像。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.