문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top