Thread Subject: How to change a gui's figure icon

Subject: How to change a gui's figure icon

From: Daniel

Date: 26 Jun, 2008 15:21:02

Message: 1 of 18

I am writing a large multi-windowed GUI in MATLAB and I
would like the window (figure) icon for each window to be
different.

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

Subject: How to change a gui's figure icon

From: matt dash

Date: 26 Jun, 2008 15:46:02

Message: 2 of 18

"Daniel " <anothermathgeek+matlab@gmail.com> wrote in
message <g40c4u$h4b$1@fred.mathworks.com>...
> I am writing a large multi-windowed GUI in MATLAB and I
> would like the window (figure) icon for each window to be
> different.
>
> 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)

Subject: How to change a gui's figure icon

From: Daniel

Date: 26 Jun, 2008 16:26:02

Message: 3 of 18

Ok, tried it. But I receive the following error:

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.

Subject: How to change a gui's figure icon

From: matt dash

Date: 26 Jun, 2008 16:50:19

Message: 4 of 18

"Daniel " <anothermathgeek+matlab@gmail.com> wrote in
message <g40fuq$2gh$1@fred.mathworks.com>...
> Ok, tried it. But I receive the following error:
>
> 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.

Subject: How to change a gui's figure icon

From: doyle.tla@gmail.com

Date: 29 Jul, 2008 12:01:54

Message: 5 of 18

On Jun 27, 12:50=A0am, "matt dash" <n...@mail.com> wrote:
> "Daniel " <anothermathgeek+mat...@gmail.com> wrote in
> message <g40fuq$2g...@fred.mathworks.com>...
>
> > Ok, tried it. But I receive the following error:
>
> > Error in =3D=3D> hddprofile_editor>setWindowTitleIcon at 71
> > jframe=3Dget(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.

Subject: How to change a gui's figure icon

From: Bruno Luong

Date: 29 Jul, 2008 12:23:01

Message: 6 of 18

You should be aware that by changing the icone you would
violate Mathworks license agreement.

Bruno

Subject: How to change a gui's figure icon

From: Zulkifli

Date: 23 Feb, 2010 09:30:37

Message: 7 of 18

"matt dash" <n.a@mail.com> wrote in message <g40hcb$jdd$1@fred.mathworks.com>...
> "Daniel " <anothermathgeek+matlab@gmail.com> wrote in
> message <g40fuq$2gh$1@fred.mathworks.com>...
> > Ok, tried it. But I receive the following error:
> >
> > 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.


What do you mean by pasted that out of a gui? then, where do you paste it?

Subject: How to change a gui's figure icon

From: Zulkifli

Date: 23 Feb, 2010 09:32:07

Message: 8 of 18

"matt dash" <n.a@mail.com> wrote in message <g40hcb$jdd$1@fred.mathworks.com>...
> "Daniel " <anothermathgeek+matlab@gmail.com> wrote in
> message <g40fuq$2gh$1@fred.mathworks.com>...
> > Ok, tried it. But I receive the following error:
> >
> > 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.


What do you mean by pasted that out of a gui? then, where do you paste it?

Subject: How to change a gui's figure icon

From: uzumaki tornado

Date: 16 Jun, 2010 20:09:04

Message: 9 of 18

"Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hm07an$ok2$1@fred.mathworks.com>...
> "matt dash" <n.a@mail.com> wrote in message <g40hcb$jdd$1@fred.mathworks.com>...
> > "Daniel " <anothermathgeek+matlab@gmail.com> wrote in
> > message <g40fuq$2gh$1@fred.mathworks.com>...
> > > Ok, tried it. But I receive the following error:
> > >
> > > 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.
>
>
> What do you mean by pasted that out of a gui? then, where do you paste it?

use jframe=get(handles.output, 'javaframe');

Subject: How to change a gui's figure icon

From: Nickolai

Date: 2 Jun, 2011 14:40:20

Message: 10 of 18

"uzumaki tornado" wrote in message <hvbb10$slu$1@fred.mathworks.com>...
> "Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hm07an$ok2$1@fred.mathworks.com>...
> > "matt dash" <n.a@mail.com> wrote in message <g40hcb$jdd$1@fred.mathworks.com>...
> > > "Daniel " <anothermathgeek+matlab@gmail.com> wrote in
> > > message <g40fuq$2gh$1@fred.mathworks.com>...
> > > > Ok, tried it. But I receive the following error:
> > > >
> > > > 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.
> >
> >
> > 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?

Subject: How to change a gui's figure icon

From: matt dash

Date: 2 Jun, 2011 18:50:20

Message: 11 of 18

"Nickolai" wrote in message <is87cj$dhh$1@newscl01ah.mathworks.com>...
> "uzumaki tornado" wrote in message <hvbb10$slu$1@fred.mathworks.com>...
> > "Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hm07an$ok2$1@fred.mathworks.com>...
> > > "matt dash" <n.a@mail.com> wrote in message <g40hcb$jdd$1@fred.mathworks.com>...
> > > > "Daniel " <anothermathgeek+matlab@gmail.com> wrote in
> > > > message <g40fuq$2gh$1@fred.mathworks.com>...
> > > > > Ok, tried it. But I receive the following error:
> > > > >
> > > > > 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.
> > >
> > >
> > > 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.

Subject: How to change a gui's figure icon

From: Nickolai

Date: 2 Jun, 2011 19:20:20

Message: 12 of 18

"matt dash" wrote in message <is8m1c$1b9$1@newscl01ah.mathworks.com>...
> "Nickolai" wrote in message <is87cj$dhh$1@newscl01ah.mathworks.com>...
> > "uzumaki tornado" wrote in message <hvbb10$slu$1@fred.mathworks.com>...
> > > "Zulkifli " <zulkifliaziz@yahoo.com> wrote in message <hm07an$ok2$1@fred.mathworks.com>...
> > > > "matt dash" <n.a@mail.com> wrote in message <g40hcb$jdd$1@fred.mathworks.com>...
> > > > > "Daniel " <anothermathgeek+matlab@gmail.com> wrote in
> > > > > message <g40fuq$2gh$1@fred.mathworks.com>...
> > > > > > Ok, tried it. But I receive the following error:
> > > > > >
> > > > > > 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.
> > > >
> > > >
> > > > 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.

Subject: How to change a gui's figure icon

From: pink

Date: 2 Jun, 2011 21:05:07

Message: 13 of 18

"Daniel" wrote in message <g40c4u$h4b$1@fred.mathworks.com>...
> I am writing a large multi-windowed GUI in MATLAB and I
> would like the window (figure) icon for each window to be
> different.
>
> 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

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

Subject: How to change a gui's figure icon

From: Nickolai

Date: 2 Jun, 2011 21:30:08

Message: 14 of 18

"pink" wrote in message <is8tu3$qge$1@newscl01ah.mathworks.com>...
> "Daniel" wrote in message <g40c4u$h4b$1@fred.mathworks.com>...
> > I am writing a large multi-windowed GUI in MATLAB and I
> > would like the window (figure) icon for each window to be
> > different.
> >
> > 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
>
> 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!

Subject: How to change a gui's figure icon

From: matt dash

Date: 3 Jun, 2011 15:34:04

Message: 15 of 18

"Nickolai" wrote in message <is8vd0$179$1@newscl01ah.mathworks.com>...
> "pink" wrote in message <is8tu3$qge$1@newscl01ah.mathworks.com>...
> > "Daniel" wrote in message <g40c4u$h4b$1@fred.mathworks.com>...
> > > I am writing a large multi-windowed GUI in MATLAB and I
> > > would like the window (figure) icon for each window to be
> > > different.
> > >
> > > 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
> >
> > 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.

Subject: How to change a gui's figure icon

From: pink

Date: 3 Jun, 2011 16:17:04

Message: 16 of 18

"matt dash" wrote in message <isautc$efm$1@newscl01ah.mathworks.com>...
> "Nickolai" wrote in message <is8vd0$179$1@newscl01ah.mathworks.com>...
> > "pink" wrote in message <is8tu3$qge$1@newscl01ah.mathworks.com>...
> > > "Daniel" wrote in message <g40c4u$h4b$1@fred.mathworks.com>...
> > > > I am writing a large multi-windowed GUI in MATLAB and I
> > > > would like the window (figure) icon for each window to be
> > > > different.
> > > >
> > > > 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
> > >
> > > 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?

Subject: How to change a gui's figure icon

From: Nor Muzakkir

Date: 14 Jun, 2011 13:00:18

Message: 17 of 18

http://www.mathworks.com/support/contact_us/dev/javaframe.html

they are removing the JavaFrame property. probably to stop others from replacing the MATLAB icon logo.

Subject: How to change a gui's figure icon

From: ny

Date: 4 Oct, 2011 15:13:25

Message: 18 of 18

> 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
 
--> this is how to change the desktop icon (short-cut to the exe file), not the figure icon..

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
iconsi ra ti 23 Sep, 2008 14:50:41
figure Daniel 26 Jun, 2008 11:27:26
window Daniel 26 Jun, 2008 11:27:26
gui Daniel 26 Jun, 2008 11:27:26
icon Daniel 26 Jun, 2008 11:27:26
rssFeed for this Thread

Contact us at files@mathworks.com