<?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: Minimize/maximize figure window	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/minimize-maximize-figure-window/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=minimize-maximize-figure-window</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Thu, 16 Jan 2025 14:38:59 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Alexander L		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-526299</link>

		<dc:creator><![CDATA[Alexander L]]></dc:creator>
		<pubDate>Thu, 16 Jan 2025 14:38:59 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-526299</guid>

					<description><![CDATA[For me warning concerning about removing JFrame displayed even if I wrap gcf in &lt;i&gt;handle()&lt;/i&gt;: 

warning(&#039;off&#039;, &#039;MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame&#039;)
jFrame = get(handle(gcf), &#039;JavaFrame&#039;)
&#039;Warning: The JavaFrame figure property will be removed in a future release. For more information see &lt;a href=&quot;https://www.mathworks.com/products/matlab/app-designer/java-swing-alternatives.html&quot; rel=&quot;nofollow ugc&quot;&gt;UI Alternatives for MATLAB Apps&lt;/a&gt; on mathworks.com.&#039;
jFrame =
com.mathworks.hg.peer.HG2FigurePeer@82c57b3


Workaround for silencing this warning is to issue
warning(&#039;off&#039;, &#039;MATLAB:ui:javaframe:PropertyToBeRemoved&#039;)

before executing &lt;i&gt;get(handle(gcf), &#039;JavaFrame&#039;)&lt;/i&gt; call.

I&#039;m using Matlab R2024a, but it is seems that it is actual at least for Matlab R2019b (https://neuroimage.usc.edu/forums/t/silencing-matlab-warning-messages-about-javacomponent/22305/2).]]></description>
			<content:encoded><![CDATA[<p>For me warning concerning about removing JFrame displayed even if I wrap gcf in <i>handle()</i>: </p>
<p>warning(&#8216;off&#8217;, &#8216;MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame&#8217;)<br />
jFrame = get(handle(gcf), &#8216;JavaFrame&#8217;)<br />
&#8216;Warning: The JavaFrame figure property will be removed in a future release. For more information see <a href="https://www.mathworks.com/products/matlab/app-designer/java-swing-alternatives.html" rel="nofollow ugc">UI Alternatives for MATLAB Apps</a> on mathworks.com.&#8217;<br />
jFrame =<br />
com.mathworks.hg.peer.HG2FigurePeer@82c57b3</p>
<p>Workaround for silencing this warning is to issue<br />
warning(&#8216;off&#8217;, &#8216;MATLAB:ui:javaframe:PropertyToBeRemoved&#8217;)</p>
<p>before executing <i>get(handle(gcf), &#8216;JavaFrame&#8217;)</i> call.</p>
<p>I&#8217;m using Matlab R2024a, but it is seems that it is actual at least for Matlab R2019b (<a href="https://neuroimage.usc.edu/forums/t/silencing-matlab-warning-messages-about-javacomponent/22305/2" rel="nofollow ugc">https://neuroimage.usc.edu/forums/t/silencing-matlab-warning-messages-about-javacomponent/22305/2</a>).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-403774</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Mon, 27 Mar 2017 08:40:53 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-403774</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-403756&quot;&gt;Richard B Hodges&lt;/a&gt;.

@Richard - http://undocumentedmatlab.com/blog/hg2-update#observations]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-403756">Richard B Hodges</a>.</p>
<p>@Richard &#8211; <a href="http://undocumentedmatlab.com/blog/hg2-update#observations" rel="ugc">http://undocumentedmatlab.com/blog/hg2-update#observations</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Richard B Hodges		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-403756</link>

		<dc:creator><![CDATA[Richard B Hodges]]></dc:creator>
		<pubDate>Mon, 27 Mar 2017 01:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-403756</guid>

					<description><![CDATA[In 2017a, jFrameProxy = jFrame.fFigureClient.getWindow()  gives an error:

Undefined function or variable &#039;fFigureClient&#039;

Is there any replacement for functionality?]]></description>
			<content:encoded><![CDATA[<p>In 2017a, jFrameProxy = jFrame.fFigureClient.getWindow()  gives an error:</p>
<p>Undefined function or variable &#8216;fFigureClient&#8217;</p>
<p>Is there any replacement for functionality?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-391130</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 20 Oct 2016 16:25:29 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-391130</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-391097&quot;&gt;Stijn Helsen&lt;/a&gt;.

@Stijn - try adding &lt;i&gt;&lt;b&gt;pause&lt;/b&gt;(0.5)&lt;/i&gt; after the &lt;i&gt;&lt;b&gt;drawnow&lt;/b&gt;&lt;/i&gt;. If it works then you can play with the &lt;i&gt;&lt;b&gt;pause&lt;/b&gt;&lt;/i&gt; duration to find the minimal duration value that works well on your specific system.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-391097">Stijn Helsen</a>.</p>
<p>@Stijn &#8211; try adding <i><b>pause</b>(0.5)</i> after the <i><b>drawnow</b></i>. If it works then you can play with the <i><b>pause</b></i> duration to find the minimal duration value that works well on your specific system.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Stijn Helsen		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-391097</link>

		<dc:creator><![CDATA[Stijn Helsen]]></dc:creator>
		<pubDate>Thu, 20 Oct 2016 06:47:55 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-391097</guid>

					<description><![CDATA[I wanted to use the maximize function to get the size of the screen on which a figure is shown (using multiple screens).  And &quot;manually&quot; (step by step) this works, but in a function, this doesn&#039;t!  In debugging mode, executing it, it works too.
&lt;pre lang=&quot;matlab&quot;&gt;
jFrame = get(handle(figs(1)),&#039;JavaFrame&#039;);
jFrame.setMaximized(true)
% nothing that I tried helps (drawnow, ...)
pos0 = get(figs(1),&#039;Position&#039;);
&lt;/pre&gt;
When I first saw this, I thought: &quot;simple: just add drawnow&quot;, but that didn&#039;t help.
Any idea?]]></description>
			<content:encoded><![CDATA[<p>I wanted to use the maximize function to get the size of the screen on which a figure is shown (using multiple screens).  And &#8220;manually&#8221; (step by step) this works, but in a function, this doesn&#8217;t!  In debugging mode, executing it, it works too.</p>
<pre lang="matlab">
jFrame = get(handle(figs(1)),'JavaFrame');
jFrame.setMaximized(true)
% nothing that I tried helps (drawnow, ...)
pos0 = get(figs(1),'Position');
</pre>
<p>When I first saw this, I thought: &#8220;simple: just add drawnow&#8221;, but that didn&#8217;t help.<br />
Any idea?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Image Analyst		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-335570</link>

		<dc:creator><![CDATA[Image Analyst]]></dc:creator>
		<pubDate>Wed, 29 Oct 2014 20:49:01 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-335570</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-334380&quot;&gt;ImageAnalyst&lt;/a&gt;.

Thanks.  I didn&#039;t know what that resize stuff was - I just had it in there because other code above did, and I thought I needed it.  I just removed that line and now everything works great.  Thanks for figuring it out for me!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-334380">ImageAnalyst</a>.</p>
<p>Thanks.  I didn&#8217;t know what that resize stuff was &#8211; I just had it in there because other code above did, and I thought I needed it.  I just removed that line and now everything works great.  Thanks for figuring it out for me!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-335556</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 29 Oct 2014 17:51:45 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-335556</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-335553&quot;&gt;ImageAnalyst&lt;/a&gt;.

@IA - I&#039;m afraid that this is the behavior for figure windows that have &lt;b&gt;Resize&lt;/b&gt;=&#039;off&#039;. If you set &lt;b&gt;Resize&lt;/b&gt;=&#039;on&#039; (the default value), then it will work as you expect vis-a-vis the taskbar. If you wish to get the &lt;b&gt;Resize&lt;/b&gt;=&#039;on&#039; behavior while still disabling resizing you can use the following code snippet:

&lt;pre lang=&#039;matlab&#039;&gt;
jFrame = get(handle(gcf),&#039;JavaFrame&#039;);  % Resize=&#039;on&#039;
drawnow; pause(0.1);
try
    jClient = jFrame.fHG1Client;  % HG1
catch
    jClient = jFrame.fHG2Client;  % HG2
end
jClient.setMaximized(true);
jWindow = jClient.getWindow;
maxSize = jWindow.getSize;
jWindow.setMinimumSize(maxSize);
jWindow.setMaximumSize(maxSize);
jWindow.setLocation(java.awt.Point(0,0));
&lt;/pre&gt;

It&#039;s not perfect, but close enough...]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-335553">ImageAnalyst</a>.</p>
<p>@IA &#8211; I&#8217;m afraid that this is the behavior for figure windows that have <b>Resize</b>=&#8217;off&#8217;. If you set <b>Resize</b>=&#8217;on&#8217; (the default value), then it will work as you expect vis-a-vis the taskbar. If you wish to get the <b>Resize</b>=&#8217;on&#8217; behavior while still disabling resizing you can use the following code snippet:</p>
<pre lang='matlab'>
jFrame = get(handle(gcf),'JavaFrame');  % Resize='on'
drawnow; pause(0.1);
try
    jClient = jFrame.fHG1Client;  % HG1
catch
    jClient = jFrame.fHG2Client;  % HG2
end
jClient.setMaximized(true);
jWindow = jClient.getWindow;
maxSize = jWindow.getSize;
jWindow.setMinimumSize(maxSize);
jWindow.setMaximumSize(maxSize);
jWindow.setLocation(java.awt.Point(0,0));
</pre>
<p>It&#8217;s not perfect, but close enough&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ImageAnalyst		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-335553</link>

		<dc:creator><![CDATA[ImageAnalyst]]></dc:creator>
		<pubDate>Wed, 29 Oct 2014 17:31:42 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-335553</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-334380&quot;&gt;ImageAnalyst&lt;/a&gt;.

Yair, it works now.  Just one little problem.  It&#039;s SO maximized that it covers up the Windows 7 task bar at the bottom of my screen.  Is there any way to have it maximized but still have the taskbar show up?  That&#039;s the way maximizing normally works.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-334380">ImageAnalyst</a>.</p>
<p>Yair, it works now.  Just one little problem.  It&#8217;s SO maximized that it covers up the Windows 7 task bar at the bottom of my screen.  Is there any way to have it maximized but still have the taskbar show up?  That&#8217;s the way maximizing normally works.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-334455</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Sat, 18 Oct 2014 15:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-334455</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-334380&quot;&gt;ImageAnalyst&lt;/a&gt;.

@IA - Probably because the figure window is not fully rendered when the jFrame code is reached. This is due to the fact that in R2014b, the &lt;i&gt;&lt;b&gt;figure&lt;/b&gt;&lt;/i&gt; function &lt;a target=&quot;_blank&quot; href=&quot;http://www.mathworks.com/help/matlab/graphics_transition/why-do-figures-display-all-at-once.html&quot; rel=&quot;nofollow&quot;&gt;no longer blocks execution&lt;/a&gt; until the figure is fully rendered.

I suggest moving the &lt;code&gt;drawnow; pause(0.1);&lt;/code&gt; code to before the jFrame code, rather than after it - this will ensure that the figure is fully rendered at that time:

&lt;pre lang=&quot;matlab&quot;&gt; 
% Enlarge figure to full screen.
jFrame = get(handle(gcf),&#039;JavaFrame&#039;);
set(gcf,&#039;Resize&#039;,&#039;off&#039;);
drawnow; pause(0.1);
try
    jFrame.fHG1Client.setMaximized(true);  % HG1
catch
    jFrame.fHG2Client.setMaximized(true);  % HG2
end
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-334380">ImageAnalyst</a>.</p>
<p>@IA &#8211; Probably because the figure window is not fully rendered when the jFrame code is reached. This is due to the fact that in R2014b, the <i><b>figure</b></i> function <a target="_blank" href="http://www.mathworks.com/help/matlab/graphics_transition/why-do-figures-display-all-at-once.html" rel="nofollow">no longer blocks execution</a> until the figure is fully rendered.</p>
<p>I suggest moving the <code>drawnow; pause(0.1);</code> code to before the jFrame code, rather than after it &#8211; this will ensure that the figure is fully rendered at that time:</p>
<pre lang="matlab"> 
% Enlarge figure to full screen.
jFrame = get(handle(gcf),'JavaFrame');
set(gcf,'Resize','off');
drawnow; pause(0.1);
try
    jFrame.fHG1Client.setMaximized(true);  % HG1
catch
    jFrame.fHG2Client.setMaximized(true);  % HG2
end
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ImageAnalyst		</title>
		<link>https://undocumentedmatlab.com/articles/minimize-maximize-figure-window#comment-334380</link>

		<dc:creator><![CDATA[ImageAnalyst]]></dc:creator>
		<pubDate>Fri, 17 Oct 2014 16:34:10 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2310#comment-334380</guid>

					<description><![CDATA[Here&#039;s my code:

&lt;pre lang=&quot;matlab&quot;&gt; 
% Enlarge figure to full screen.
jFrame = get(handle(gcf),&#039;JavaFrame&#039;);
set(gcf,&#039;Resize&#039;,&#039;off&#039;);
try
    jFrame.fHG1Client.setMaximized(true);  % HG1
catch
    jFrame.fHG2Client.setMaximized(true);  % HG2
end
drawnow; 
pause(0.1);
&lt;/pre&gt;

If I just let this run in R2014b (HG2) it throws an exception:

&lt;pre lang=&quot;matlab&quot;&gt; 
Error using test (line 60)
Java exception occurred:
java.lang.NullPointerException
	at com.mathworks.hg.peer.FigureFrameProxy.setMaximized(FigureFrameProxy.java:302)
	at com.mathworks.hg.peer.FigureMediator.setMaximized(FigureMediator.java:468)
&lt;/pre&gt;

and does not maximize the figure.  HOWEVER, if I put a breakpoint anywhere in the try/catch, and it stops there, and I hit F5 to continue, it works just fine with no exception at all being thrown, just an orange warning:

&lt;pre lang=&quot;matlab&quot;&gt; 
Warning: figure JavaFrame property will be obsoleted in a future release. For more information see the JavaFrame resource on the MathWorks web site. 
&gt; In test at 55 
&lt;/pre&gt;

Why does it work only if there is a breakpoint stopped at and not when I just run it non-stop like I&#039;d want?]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my code:</p>
<pre lang="matlab"> 
% Enlarge figure to full screen.
jFrame = get(handle(gcf),'JavaFrame');
set(gcf,'Resize','off');
try
    jFrame.fHG1Client.setMaximized(true);  % HG1
catch
    jFrame.fHG2Client.setMaximized(true);  % HG2
end
drawnow; 
pause(0.1);
</pre>
<p>If I just let this run in R2014b (HG2) it throws an exception:</p>
<pre lang="matlab"> 
Error using test (line 60)
Java exception occurred:
java.lang.NullPointerException
	at com.mathworks.hg.peer.FigureFrameProxy.setMaximized(FigureFrameProxy.java:302)
	at com.mathworks.hg.peer.FigureMediator.setMaximized(FigureMediator.java:468)
</pre>
<p>and does not maximize the figure.  HOWEVER, if I put a breakpoint anywhere in the try/catch, and it stops there, and I hit F5 to continue, it works just fine with no exception at all being thrown, just an orange warning:</p>
<pre lang="matlab"> 
Warning: figure JavaFrame property will be obsoleted in a future release. For more information see the JavaFrame resource on the MathWorks web site. 
> In test at 55 
</pre>
<p>Why does it work only if there is a breakpoint stopped at and not when I just run it non-stop like I&#8217;d want?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
