Add Icons to GUI menus

版本 1.4.0.0 (22.7 KB) 作者: Alexander Mering
Adds icons to the main figure menu of a given GUI
966.0 次下载
更新时间 2013/12/2

查看许可证

Given the handle of a GUI, this function attaches the icons stored in the "UserData" of each menu handle to the figure. As a result, the given GUI is enriched by properly implemented icons, added to the uimenu on the java level.

For the icons, filenames on the path, full qualified file names or java ImageIcon could be given.

Details can be found in the example.

USAGE:

% Attach icon data to the menu handles UserData

set(handles.Menu_File, 'UserData', '') % Also topevel handle could get the icon
set(handles.Menu_File_New, 'UserData', 'File_New.png')
set(handles.Menu_File_Load, 'UserData', 'File_Load.png')
set(handles.Menu_File_Save, 'UserData', 'File_Save.png') % get file on path
set(handles.Menu_File_Exit, 'UserData', 'File_Exit.png')

% Set the icons
Figure_Menu_Add_Icons(handles.Main)

-------
Aknowledgment: Some of the ideas used here are based on the great work of Yair Altman (http://undocumentedmatlab.com/) as presented in http://undocumentedmatlab.com/blog/customizing-menu-items-part-2/ and http://undocumentedmatlab.com/blog/customizing-menu-items-part-3/.

引用格式

Alexander Mering (2024). Add Icons to GUI menus (https://www.mathworks.com/matlabcentral/fileexchange/44483-add-icons-to-gui-menus), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011b
兼容任何版本
平台兼容性
Windows macOS Linux
致谢

启发作品: setMenuIcon

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.4.0.0

Shortcoming removed as mentioned by Thierry

1.3.0.0

Comment added

1.1.0.0

Added aknowledgement

1.0.0.0