Code covered by the BSD License  

Highlights from
Add Icons to GUI menus

4.0

4.0 | 1 rating Rate this file 25 Downloads (last 30 days) File Size: 22.7 KB File ID: #44483
image thumbnail

Add Icons to GUI menus

by

 

25 Nov 2013 (Updated )

Adds icons to the main figure menu of a given GUI

| Watch this File

File Information
Description

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/.

MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
27 Nov 2013 Thierry Dalon

Idea is good. But implementation still contains some bugs. (Example gcf is used instead of input hfig)

26 Nov 2013 Dongwon  
Updates
27 Nov 2013

Added aknowledgement

27 Nov 2013

Comment added

02 Dec 2013

Shortcoming removed as mentioned by Thierry

Contact us