<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Setting system tray icons</title>
	<atom:link href="http://undocumentedmatlab.com/blog/setting-system-tray-icons/feed/" rel="self" type="application/rss+xml" />
	<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/</link>
	<description>Charting Matlab's unsupported hidden underbelly</description>
	<lastBuildDate>Tue, 07 Sep 2010 22:25:59 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/comment-page-1/#comment-74</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Sat, 04 Apr 2009 16:55:24 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=67#comment-74</guid>
		<description>wei - you can change the figure icon (not without the JavaFrame), but I&#039;m told this &lt;a href=&quot;http://www.mathworks.com/support/solutions/data/1-16N4J.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;may violate Matlab&#039;s license&lt;/a&gt;. I&#039;m really not sure why MathWorks (TMW) chose to limit this pretty harmless customization, but there you have it. In all my posts I try to stay on the good side of the line, so I&#039;m afraid I can&#039;t help you here... If you have a specific need for a customer project, then perhaps if you approach TMW they&#039;ll agree to give you special permission.</description>
		<content:encoded><![CDATA[<p>wei &#8211; you can change the figure icon (not without the JavaFrame), but I&#8217;m told this <a href="http://www.mathworks.com/support/solutions/data/1-16N4J.html" target="_blank" rel="nofollow">may violate Matlab&#8217;s license</a>. I&#8217;m really not sure why MathWorks (TMW) chose to limit this pretty harmless customization, but there you have it. In all my posts I try to stay on the good side of the line, so I&#8217;m afraid I can&#8217;t help you here&#8230; If you have a specific need for a customer project, then perhaps if you approach TMW they&#8217;ll agree to give you special permission.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wei</title>
		<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/comment-page-1/#comment-66</link>
		<dc:creator>wei</dc:creator>
		<pubDate>Fri, 03 Apr 2009 15:05:59 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=67#comment-66</guid>
		<description>@Yair, Can one change figure&#039;s icon wihtout JavaFrame?</description>
		<content:encoded><![CDATA[<p>@Yair, Can one change figure&#8217;s icon wihtout JavaFrame?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wei</title>
		<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/comment-page-1/#comment-32</link>
		<dc:creator>wei</dc:creator>
		<pubDate>Tue, 31 Mar 2009 22:11:41 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=67#comment-32</guid>
		<description>@Yair, That&#039;s nice to know. Thank you.</description>
		<content:encoded><![CDATA[<p>@Yair, That&#8217;s nice to know. Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/comment-page-1/#comment-31</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Tue, 31 Mar 2009 21:15:15 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=67#comment-31</guid>
		<description>@wei - your method is ok for simple filenames - I simply forgot that the ImageIcon constructor also accepts a filename. In practice, within that constructor it calls the awt Toolkit to process the file so there&#039;s no performance difference, but obviously the code is more readable/maintainable this way. BTW, you can also use URL images, for example:

&lt;blockquote&gt;&lt;pre&gt;
jarFile = fullfile(matlabroot,&#039;/java/jar/mwt.jar&#039;);
iconsFolder = &#039;/com/mathworks/mwt/resources/&#039;;
myIcon = [&#039;jar:file:/&#039; jarFile &#039;!&#039; iconsFolder &#039;save.gif&#039;];
myIcon = java.net.URL(myIcon);  % not necessary for simple external files
jSave.setIcon(javax.swing.ImageIcon(myIcon));
&lt;/pre&gt;&lt;/blockquote&gt;

If you wish to use the icon to set a specific component mouse cursor (hover pointer), you DO need to use the awt.Toolkit:

&lt;blockquote&gt;&lt;pre&gt;
myIcon = fullfile(matlabroot,&#039;/toolbox/matlab/icons/matlabicon.gif&#039;);
imageToolkit = java.awt.Toolkit.getDefaultToolkit;
iconImage = imageToolkit.createImage(myIcon);
hotSpot = java.awt.Point(20,0);   % =Matlab icon point (top) after 16x16=&gt;32x32 resize
myCursor = imageToolkit.createCustomCursor(iconImage,hotSpot,&#039;My Cursor&#039;);
jButton.setCursor(myCursor);
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;img src=&quot;http://undocumentedmatlab.com/images/cursor3.png&quot; alt=&quot;custom button cursor&quot; /&gt;</description>
		<content:encoded><![CDATA[<p>@wei &#8211; your method is ok for simple filenames &#8211; I simply forgot that the ImageIcon constructor also accepts a filename. In practice, within that constructor it calls the awt Toolkit to process the file so there&#8217;s no performance difference, but obviously the code is more readable/maintainable this way. BTW, you can also use URL images, for example:</p>
<blockquote><pre>
jarFile = fullfile(matlabroot,'/java/jar/mwt.jar');
iconsFolder = '/com/mathworks/mwt/resources/';
myIcon = ['jar:file:/' jarFile '!' iconsFolder 'save.gif'];
myIcon = java.net.URL(myIcon);  % not necessary for simple external files
jSave.setIcon(javax.swing.ImageIcon(myIcon));
</pre>
</blockquote>
<p>If you wish to use the icon to set a specific component mouse cursor (hover pointer), you DO need to use the awt.Toolkit:</p>
<blockquote><pre>
myIcon = fullfile(matlabroot,'/toolbox/matlab/icons/matlabicon.gif');
imageToolkit = java.awt.Toolkit.getDefaultToolkit;
iconImage = imageToolkit.createImage(myIcon);
hotSpot = java.awt.Point(20,0);   % =Matlab icon point (top) after 16x16=>32x32 resize
myCursor = imageToolkit.createCustomCursor(iconImage,hotSpot,'My Cursor');
jButton.setCursor(myCursor);
</pre>
</blockquote>
<p><img src="http://undocumentedmatlab.com/images/cursor3.png" alt="custom button cursor" /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wei</title>
		<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/comment-page-1/#comment-30</link>
		<dc:creator>wei</dc:creator>
		<pubDate>Tue, 31 Mar 2009 20:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=67#comment-30</guid>
		<description>@Yair,
I bypassed awt and directly went
&lt;blockquote&gt;&lt;pre&gt;
 iconImage = javax.swing.ImageIcon(myIcon);
 jButton.setIcon(iconImage);
&lt;/pre&gt;&lt;/blockquote&gt;

Any difference?</description>
		<content:encoded><![CDATA[<p>@Yair,<br />
I bypassed awt and directly went</p>
<blockquote><pre>
 iconImage = javax.swing.ImageIcon(myIcon);
 jButton.setIcon(iconImage);
</pre>
</blockquote>
<p>Any difference?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/comment-page-1/#comment-27</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Tue, 31 Mar 2009 15:23:07 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=67#comment-27</guid>
		<description>@wei - assuming your component has a reference handle (let&#039;s say jButton), follow this example:

&lt;blockquote&gt;&lt;pre&gt;
myIcon = fullfile(matlabroot,&#039;/toolbox/matlab/icons/matlabicon.gif&#039;);
iconImage = java.awt.Toolkit.getDefaultToolkit.createImage(myIcon);
jButton.setIcon(javax.swing.ImageIcon(iconImage));
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;img src=&quot;http://undocumentedmatlab.com/images/button_icon.png&quot; alt=&quot;Swing button icon&quot; /&gt;</description>
		<content:encoded><![CDATA[<p>@wei &#8211; assuming your component has a reference handle (let&#8217;s say jButton), follow this example:</p>
<blockquote><pre>
myIcon = fullfile(matlabroot,'/toolbox/matlab/icons/matlabicon.gif');
iconImage = java.awt.Toolkit.getDefaultToolkit.createImage(myIcon);
jButton.setIcon(javax.swing.ImageIcon(iconImage));
</pre>
</blockquote>
<p><img src="http://undocumentedmatlab.com/images/button_icon.png" alt="Swing button icon" /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wei</title>
		<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/comment-page-1/#comment-25</link>
		<dc:creator>wei</dc:creator>
		<pubDate>Tue, 31 Mar 2009 12:39:58 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=67#comment-25</guid>
		<description>Hi Yair,
How does one set icon image, e.g. JButton, for uicomponent you posted?

Thank you.</description>
		<content:encoded><![CDATA[<p>Hi Yair,<br />
How does one set icon image, e.g. JButton, for uicomponent you posted?</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Donn Shull</title>
		<link>http://undocumentedmatlab.com/blog/setting-system-tray-icons/comment-page-1/#comment-8</link>
		<dc:creator>Donn Shull</dc:creator>
		<pubDate>Wed, 25 Mar 2009 19:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=67#comment-8</guid>
		<description>Hi Yair,

I see in your TODO list that you are planning to cover the schema package. Even though the schema package is undocumented in general there are a lot of examples available in the toolbox directory to give a general sense of how to use it. There is not however a good example of how easy it is to use the schema.class javaInterfaces property to seemlessly access UDD objects from java code. I think people would be interested in that.

Donn</description>
		<content:encoded><![CDATA[<p>Hi Yair,</p>
<p>I see in your TODO list that you are planning to cover the schema package. Even though the schema package is undocumented in general there are a lot of examples available in the toolbox directory to give a general sense of how to use it. There is not however a good example of how easy it is to use the schema.class javaInterfaces property to seemlessly access UDD objects from java code. I think people would be interested in that.</p>
<p>Donn</p>
]]></content:encoded>
	</item>
</channel>
</rss>
