0

Possible Duplicate:
JMenuItem ImageIcon too big

The size of Icon to large can it decrase. See below link. https://docs.google.com/file/d/0B2PXtUeqJPCpQWFLcGQ0NTg2UVU/edit

How do i set the size of icon on MenuItem without resize with raw file pls:thanks.

4

2 回答 2

2

我想你可以通过其他方式做到这一点,但这可能值得一试——AWT 的想法;在将其设置为菜单项图标之前调整图像大小:

// myIcon is your image icon
imageToolkit = java.awt.Toolkit.getDefaultToolkit;
iconImage = imageToolkit.createImage(myIcon);
iconImage = iconImage.getScaledInstance(32,32,iconImage.SCALE_SMOOTH);
// set this icon for the menu
于 2013-01-04T09:45:44.267 回答
2

Image具有public Image getScaledInstance(int width, int height, int hints)可用于调整菜单图标大小的方法。

于 2013-01-04T09:42:50.817 回答