<?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: The javacomponent function	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/javacomponent/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/javacomponent?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=javacomponent</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Tue, 01 May 2018 13:31:55 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-424495</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 01 May 2018 13:31:55 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-424495</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/javacomponent#comment-424493&quot;&gt;Ann&lt;/a&gt;.

@Ann - the best way to delete the object is via its Matlab container panel, which is accessible as the 2nd output of &lt;i&gt;&lt;b&gt;javacomponent&lt;/b&gt;&lt;/i&gt;:
&lt;pre lang=&quot;matlab&quot;&gt;
[jRangeSlider, hContainer] = javacomponent(jRangeSlider, [150,150,850,80], hObject);
...
delete(hContainer)
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/javacomponent#comment-424493">Ann</a>.</p>
<p>@Ann &#8211; the best way to delete the object is via its Matlab container panel, which is accessible as the 2nd output of <i><b>javacomponent</b></i>:</p>
<pre lang="matlab">
[jRangeSlider, hContainer] = javacomponent(jRangeSlider, [150,150,850,80], hObject);
...
delete(hContainer)
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ann		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-424493</link>

		<dc:creator><![CDATA[Ann]]></dc:creator>
		<pubDate>Tue, 01 May 2018 13:27:42 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-424493</guid>

					<description><![CDATA[Hi Yair,

Thank you for your great blog. 
I want to use a slider so I add it to my figure in my UI_OpeningFcn(hObject is the handle to the figure).

&lt;pre lang=&quot;matlab&quot;&gt;
jRangeSlider = javacomponent(jRangeSlider, [150,150,850,80], hObject);
set(jRangeSlider, &#039;Background&#039;,java.awt.Color.white);
set(jRangeSlider, &#039;StateChangedCallback&#039;, {@sliderStartEndPoint_Callback, hObject});
&lt;/pre&gt;

However, my GUI leads to to other GUIs. That is, whenever the user press a button, the main GUI is replaced by another GUI. Therefore I need to delete my java Object. How can I do this?
Since I have to access to it from the callback of the pushbutton, I&#039;m not sure how to access the handle of the object. I have the handle of the figure but whenever I do this

&lt;pre lang=&quot;matlab&quot;&gt;
findobj(hObject.Parent, &#039;Type&#039;, &#039;JavaWrapper&#039;)
&lt;/pre&gt;

I just get
&lt;pre lang=&quot;matlab&quot;&gt;
  0x0 empty GraphicsPlaceholder array.
&lt;/pre&gt;

What am I doing wrong? How can I delete this object?

Thanks in advance]]></description>
			<content:encoded><![CDATA[<p>Hi Yair,</p>
<p>Thank you for your great blog.<br />
I want to use a slider so I add it to my figure in my UI_OpeningFcn(hObject is the handle to the figure).</p>
<pre lang="matlab">
jRangeSlider = javacomponent(jRangeSlider, [150,150,850,80], hObject);
set(jRangeSlider, 'Background',java.awt.Color.white);
set(jRangeSlider, 'StateChangedCallback', {@sliderStartEndPoint_Callback, hObject});
</pre>
<p>However, my GUI leads to to other GUIs. That is, whenever the user press a button, the main GUI is replaced by another GUI. Therefore I need to delete my java Object. How can I do this?<br />
Since I have to access to it from the callback of the pushbutton, I&#8217;m not sure how to access the handle of the object. I have the handle of the figure but whenever I do this</p>
<pre lang="matlab">
findobj(hObject.Parent, 'Type', 'JavaWrapper')
</pre>
<p>I just get</p>
<pre lang="matlab">
  0x0 empty GraphicsPlaceholder array.
</pre>
<p>What am I doing wrong? How can I delete this object?</p>
<p>Thanks in advance</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-417130</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 30 Nov 2017 18:10:42 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-417130</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/javacomponent#comment-417129&quot;&gt;Collin Pecora&lt;/a&gt;.

yes]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/javacomponent#comment-417129">Collin Pecora</a>.</p>
<p>yes</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Collin Pecora		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-417129</link>

		<dc:creator><![CDATA[Collin Pecora]]></dc:creator>
		<pubDate>Thu, 30 Nov 2017 18:03:59 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-417129</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/javacomponent#comment-417123&quot;&gt;Yair Altman&lt;/a&gt;.

Thanks Yair,

So, it would be better to use javacomponent here?

&lt;pre lang=&quot;matlab&quot;&gt;
jhBut = handle(javaObjectEDT(&#039;javax.swing.JButton&#039;,&#039;Hello!&#039;),&#039;CallbackProperties&#039;);
jhBut.ActionPerformedCallback = @this.onAction;

hPanel = uipanel(...);
hgjavacomponent(&#039;Parent&#039;,hPanel&#039;,&#039;JavaPeer&#039;,jhBut,&#039;Units&#039;,&#039;norms&#039;,&#039;Position&#039;,[0,0,1,1]);
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/javacomponent#comment-417123">Yair Altman</a>.</p>
<p>Thanks Yair,</p>
<p>So, it would be better to use javacomponent here?</p>
<pre lang="matlab">
jhBut = handle(javaObjectEDT('javax.swing.JButton','Hello!'),'CallbackProperties');
jhBut.ActionPerformedCallback = @this.onAction;

hPanel = uipanel(...);
hgjavacomponent('Parent',hPanel','JavaPeer',jhBut,'Units','norms','Position',[0,0,1,1]);
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-417123</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 30 Nov 2017 15:18:13 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-417123</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/javacomponent#comment-417118&quot;&gt;Collin Pecora&lt;/a&gt;.

@Collin - &lt;i&gt;&lt;b&gt;hgjavacomponent&lt;/b&gt;&lt;/i&gt; is a Matlab class that is meant to contain the relevant information on a contained Java-component (peer). You can think of it as a borderless panel that tightly-fits the Java peer, and enables users to set the control&#039;s position, units etc. in a manner that is very similar to standard Matlab uipanels. Importantly, &lt;i&gt;&lt;b&gt;hgjavacomponent&lt;/b&gt;&lt;/i&gt; only creates this wrapper object, NOT the peer. 

In contrast, &lt;i&gt;&lt;b&gt;javacomponent&lt;/b&gt;&lt;/i&gt; places the Java peer in the requested position, and also creates a corresponding &lt;i&gt;&lt;b&gt;hgjavacomponent&lt;/b&gt;&lt;/i&gt; object to provide the uipanel-like wrapper functionality. Both of these handles are returned when you call &lt;i&gt;&lt;b&gt;javacomponent&lt;/b&gt;&lt;/i&gt; (the java peer reference handle, followed by the &lt;i&gt;&lt;b&gt;hgjavacomponent&lt;/b&gt;&lt;/i&gt; container handle):
&lt;pre lang=&quot;matlab&quot;&gt;[hjControl, hContainer] = javacomponent(...)&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/javacomponent#comment-417118">Collin Pecora</a>.</p>
<p>@Collin &#8211; <i><b>hgjavacomponent</b></i> is a Matlab class that is meant to contain the relevant information on a contained Java-component (peer). You can think of it as a borderless panel that tightly-fits the Java peer, and enables users to set the control&#8217;s position, units etc. in a manner that is very similar to standard Matlab uipanels. Importantly, <i><b>hgjavacomponent</b></i> only creates this wrapper object, NOT the peer. </p>
<p>In contrast, <i><b>javacomponent</b></i> places the Java peer in the requested position, and also creates a corresponding <i><b>hgjavacomponent</b></i> object to provide the uipanel-like wrapper functionality. Both of these handles are returned when you call <i><b>javacomponent</b></i> (the java peer reference handle, followed by the <i><b>hgjavacomponent</b></i> container handle):</p>
<pre lang="matlab">[hjControl, hContainer] = javacomponent(...)</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Collin Pecora		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-417118</link>

		<dc:creator><![CDATA[Collin Pecora]]></dc:creator>
		<pubDate>Thu, 30 Nov 2017 14:44:03 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-417118</guid>

					<description><![CDATA[Yair

Is there a benefit to using javcomponent over hgjavacomponent?]]></description>
			<content:encoded><![CDATA[<p>Yair</p>
<p>Is there a benefit to using javcomponent over hgjavacomponent?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-410287</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Sat, 15 Jul 2017 21:16:25 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-410287</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/javacomponent#comment-409852&quot;&gt;Anu&lt;/a&gt;.

@Anu - this sounds like a bug in your code. Errors are not supposed to happen.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/javacomponent#comment-409852">Anu</a>.</p>
<p>@Anu &#8211; this sounds like a bug in your code. Errors are not supposed to happen.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Anu		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-409852</link>

		<dc:creator><![CDATA[Anu]]></dc:creator>
		<pubDate>Fri, 07 Jul 2017 06:43:59 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-409852</guid>

					<description><![CDATA[hello sir,
I have created a 2 tabgroups in my GUI.At first it is good but after adding uicontrols to those tabs using different panels i am getting errors and automatically a new hgjavacomponent is being added to GUI everytime i run the GUI. This results in abnormal behaviour of the GUI. How can i stop those hgjavacomponents visibility?]]></description>
			<content:encoded><![CDATA[<p>hello sir,<br />
I have created a 2 tabgroups in my GUI.At first it is good but after adding uicontrols to those tabs using different panels i am getting errors and automatically a new hgjavacomponent is being added to GUI everytime i run the GUI. This results in abnormal behaviour of the GUI. How can i stop those hgjavacomponents visibility?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Johannes		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-407803</link>

		<dc:creator><![CDATA[Johannes]]></dc:creator>
		<pubDate>Fri, 02 Jun 2017 12:30:27 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-407803</guid>

					<description><![CDATA[Thank you very much Yair!]]></description>
			<content:encoded><![CDATA[<p>Thank you very much Yair!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/javacomponent#comment-407274</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 24 May 2017 09:45:41 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=1793#comment-407274</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/javacomponent#comment-407218&quot;&gt;Johannes&lt;/a&gt;.

@johanes - you can do this:
&lt;pre lang=&quot;matlab&quot;&gt;set([guiel.elementA, guiel.elementB], &#039;Font&#039;, newFont2);&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/javacomponent#comment-407218">Johannes</a>.</p>
<p>@johanes &#8211; you can do this:</p>
<pre lang="matlab">set([guiel.elementA, guiel.elementB], 'Font', newFont2);</pre>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
