1

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.

Community
  • 1
  • 1
metin
  • 21
  • 3

2 Answers2

3

Image has the method public Image getScaledInstance(int width, int height, int hints) you can use to resize your menu icon.

StanislavL
  • 56,971
  • 9
  • 68
  • 98
2

I guess you could do it some other way, but this might be worth a try - an AWT idea; resize the image before setting it as the menu item icon:

// 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
acostache
  • 2,177
  • 7
  • 23
  • 48