What I mean when I say 'window icon' is the small picture
just to the left of the window's title, and the image that
shows up in the minimized version of the program on the
Windows taskbar.
I am familiar with adding icons to uibuttons, but do not
know how to change this property of a figure.
Thanks!
Daniel
warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
jframe=get(handles.fig,'javaframe');
jIcon=javax.swing.ImageIcon('C:\program
files\matlab\r2007b\icons\icon.gif');
jframe.setFigureIcon(jIcon);
(while supplies last)
Error in ==> hddprofile_editor>setWindowTitleIcon at 71
jframe=get(handles.fig,'javaframe');
Apparently my handles structure contains no property 'fig'.
Any ideas? I am in R2007a.
Sorry, i pasted that out of a gui. handles.fig is the handle
of the figure whose icon you want to change.
Wow I didn't think that could be done at all. I have asked Mathworks
about that before and was told it can't be done.
I am considering selling some guis, so if I do that and pay the $15k+
I would be pretty annoyed that I couldn't brand it.
Thanks, matt_dash
Tim.
Bruno
What do you mean by pasted that out of a gui? then, where do you paste it?
use jframe=get(handles.output, 'javaframe');
I tried this but I got a syntax error on the line:
files\matlab\r2010b\icons\icon.gif');
I commented it out, thinking it might have been a continuation of the previous line, but now when I run it instead of the MATLAB icon there's a java icon. Any ideas as to how to get it to change the program icon?
Don't do this. Changing the icon has a lot of unintended side effects that will screw up your whole matlab session. It's not worth it. Also as noted above, it goes against your license agreement.
I'm not really sure why changing the icon on an exe file would screw up my MATLAB session?
Also I'm not sure that poster really understood the question. What I'm trying to do is avoid the MATLAB icon showing up when I run my standalone application. If Mathworks didn't allow it I'm not sure they would write how-to's: http://www.mathworks.com/support/solutions/en/data/1-324E1D/?solution=1-324E1D
For the record, I have looked at that page but I think it assumes the user has visual studio, which I do not, and so I'm hoping this method might be easier.
I appreciate the concern but not doing it is simply not an option, I intend to distribute my program so having it show up with the MATLAB icon is unacceptable.
try to use this
function main_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to main (see VARARGIN)
% Choose default command line output for main
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
javaFrame = get(hObject,'JavaFrame');
javaFrame.setFigureIcon(javax.swing.ImageIcon('icon.JPG'));
icon.jpg located in the same folder with folders figures
pink
Woot, it worked! For a second I didn't see it because Windows 7 grouped it with MATLAB down in the taskbar but it's there and it works. Thanks!
The license issue is because the license agreement says you are not allowed to cover or obscure any mathworks logo. As it happens, the default figure icon is a mathworks logo, so changing it could be interpreted as obscuring their logo. Whether or not they really care about this is anyone's guess.
When using the method described in this thread to change icons, i have had issues in windows xp (maybe later versions too, i can't recall) where after changing the icon on one figure, subsequent figures are created with no icon, which is annoying for identifying them in the taskbar. I have also has issues where after changing the figure icon of any figure, the pop up boxes in the editor that tell you the current values of variables stop appearing. Like you, i have no idea why this strange side effect happens, but I'm certain this is the cause. So keep that in mind before you implement this on something you're going to distribute... it might really annoy your users.
hi, mat
if ever it gives side effects, how the steps how to change the icon that true?
they are removing the JavaFrame property. probably to stop others from replacing the MATLAB icon logo.