Question

In my program I have Actions that have different-sized icons, some intended for large buttons and some for small. I would like to reuse the same instance of each of these Actions when adding functionality to a JPopupMenu. Is there a way to force the large icons to be displayed at a smaller size?

Était-ce utile?

La solution

The Actions API provides two icon keys. SMALL_ICON and LARGE_ICON_KEY

From the JavaDocs

The JMenuItem subclasses only use SMALL_ICON. All other buttons will use LARGE_ICON_KEY; if the value is null they use SMALL_ICON.

This would suggest that you should use the SMALL_ICON key for your actions to allow JMenuItems to display the small icon.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top