<?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: Rich Matlab editbox contents	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rich-matlab-editbox-contents</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Fri, 17 Mar 2023 09:28:20 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Jeroen Boschma		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-520628</link>

		<dc:creator><![CDATA[Jeroen Boschma]]></dc:creator>
		<pubDate>Fri, 17 Mar 2023 09:28:20 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-520628</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-520466&quot;&gt;Jeroen Boschma&lt;/a&gt;.

Never mind, the new UI components have an HTML panel available. Works for me...]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-520466">Jeroen Boschma</a>.</p>
<p>Never mind, the new UI components have an HTML panel available. Works for me&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jeroen Boschma		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-520466</link>

		<dc:creator><![CDATA[Jeroen Boschma]]></dc:creator>
		<pubDate>Mon, 13 Mar 2023 11:17:27 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-520466</guid>

					<description><![CDATA[I do not seem to get the scrollbars (horizontal...) working in Matlab 2020b. Snippets of init-code (all based on Yair&#039;s snippets on this site)

&lt;pre lang=&quot;matlab&quot;&gt;
handles.text_explorer = uicontrol(fig, &#039;Style&#039;,&#039;Edit&#039;, &#039;Units&#039;,&#039;characters&#039;, &#039;Max&#039;,1000, &#039;HorizontalAlignment&#039;,&#039;Left&#039;, &#039;Position&#039;,pos_text_explorer);
handles.jScrollPane = findjobj_fast(handles.text_explorer);
jViewPort           = handles.jScrollPane.getViewport;
handles.jEditbox    = jViewPort.getComponent(0);
handles.jEditbox.setEditorKit(javax.swing.text.html.HTMLEditorKit);
handles.jEditbox.setEditable(false);
&lt;/pre&gt;

I inserted a callback to set scrollbars after a position change:

&lt;pre lang=&quot;matlab&quot;&gt;
cbFunc = @(h,e) set(h,&#039;VerticalScrollBarPolicy&#039;, javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, &#039;HorizontalScrollBarPolicy&#039;, javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
handles.hjScrollPane = handle(handles.jScrollPane, &#039;CallbackProperties&#039;);
set(handles.hjScrollPane, &#039;ComponentResizedCallback&#039;, cbFunc);
&lt;/pre&gt;

Then I have another function to set scrollbars:

&lt;pre lang=&quot;matlab&quot;&gt;
function set_scrollbars(handles)
    handles.jScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    handles.jScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
end
&lt;/pre&gt;

I call that function everywhere (after text change, position change, etc...) to see if I can get the horizontal scrollbar working. Sometimes a scrollbar is rendered, but then quickly disappears. Or sometimes (no idea why...) a scrollbar remains visible, but it is not functional (no slider in it). Same behavior when not using HTML but using plain text. Strange...]]></description>
			<content:encoded><![CDATA[<p>I do not seem to get the scrollbars (horizontal&#8230;) working in Matlab 2020b. Snippets of init-code (all based on Yair&#8217;s snippets on this site)</p>
<pre lang="matlab">
handles.text_explorer = uicontrol(fig, 'Style','Edit', 'Units','characters', 'Max',1000, 'HorizontalAlignment','Left', 'Position',pos_text_explorer);
handles.jScrollPane = findjobj_fast(handles.text_explorer);
jViewPort           = handles.jScrollPane.getViewport;
handles.jEditbox    = jViewPort.getComponent(0);
handles.jEditbox.setEditorKit(javax.swing.text.html.HTMLEditorKit);
handles.jEditbox.setEditable(false);
</pre>
<p>I inserted a callback to set scrollbars after a position change:</p>
<pre lang="matlab">
cbFunc = @(h,e) set(h,'VerticalScrollBarPolicy', javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, 'HorizontalScrollBarPolicy', javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
handles.hjScrollPane = handle(handles.jScrollPane, 'CallbackProperties');
set(handles.hjScrollPane, 'ComponentResizedCallback', cbFunc);
</pre>
<p>Then I have another function to set scrollbars:</p>
<pre lang="matlab">
function set_scrollbars(handles)
    handles.jScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    handles.jScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
end
</pre>
<p>I call that function everywhere (after text change, position change, etc&#8230;) to see if I can get the horizontal scrollbar working. Sometimes a scrollbar is rendered, but then quickly disappears. Or sometimes (no idea why&#8230;) a scrollbar remains visible, but it is not functional (no slider in it). Same behavior when not using HTML but using plain text. Strange&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Chopper		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-390114</link>

		<dc:creator><![CDATA[Chopper]]></dc:creator>
		<pubDate>Thu, 06 Oct 2016 14:33:34 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-390114</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-390112&quot;&gt;Chopper&lt;/a&gt;.

@Yair

It works! Just have to add &#039;file:/&#039; at the front of the path!
Thank you so much Sir! 
:D]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-390112">Chopper</a>.</p>
<p>@Yair</p>
<p>It works! Just have to add &#8216;file:/&#8217; at the front of the path!<br />
Thank you so much Sir!<br />
😀</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-390113</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 06 Oct 2016 14:09:43 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-390113</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-390112&quot;&gt;Chopper&lt;/a&gt;.

@Chopper - see here: http://undocumentedmatlab.com/blog/images-in-matlab-uicontrols-and-labels]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-390112">Chopper</a>.</p>
<p>@Chopper &#8211; see here: <a href="http://undocumentedmatlab.com/blog/images-in-matlab-uicontrols-and-labels" rel="ugc">http://undocumentedmatlab.com/blog/images-in-matlab-uicontrols-and-labels</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Chopper		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-390112</link>

		<dc:creator><![CDATA[Chopper]]></dc:creator>
		<pubDate>Thu, 06 Oct 2016 14:05:10 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-390112</guid>

					<description><![CDATA[Hello there,

I am kind of new when it comes to combining MATLAB with Java..
However, I would like to ask on something that is related to this &#039;Rich-Editbox&#039;

Well, I read and set the HTML with the following codes: -
&lt;pre lang=&quot;matlab&quot;&gt;
myHtml = &#039;About1.html&#039;;
readFile = fileread(myHtml);

hFig = gcf;
jEditPane = javax.swing.JEditorPane(&#039;text/html&#039;, readFile)
jScrollPane = javax.swing.JScrollPane(jEditPane)

[hcomponent, hcontainer] = javacomponent( jScrollPane, [], hFig)
set(hcontainer, &#039;units&#039;, &#039;normalized&#039;, &#039;position&#039;, [0,0,1,1]);

&lt;/pre&gt;

The texts are fine but not for the image.

Supposedly it should be displaying like this (directly from html page)
https://postimg.org/image/lge4hdvb9/

but in MATLAB, it appeared like this one
https://postimg.org/image/3rmdprjk5/

All the src=&#039;path&#039; is correct.. But I have no idea on how to display the image in MATLAB... Any idea?

Regards,]]></description>
			<content:encoded><![CDATA[<p>Hello there,</p>
<p>I am kind of new when it comes to combining MATLAB with Java..<br />
However, I would like to ask on something that is related to this &#8216;Rich-Editbox&#8217;</p>
<p>Well, I read and set the HTML with the following codes: &#8211;</p>
<pre lang="matlab">
myHtml = 'About1.html';
readFile = fileread(myHtml);

hFig = gcf;
jEditPane = javax.swing.JEditorPane('text/html', readFile)
jScrollPane = javax.swing.JScrollPane(jEditPane)

[hcomponent, hcontainer] = javacomponent( jScrollPane, [], hFig)
set(hcontainer, 'units', 'normalized', 'position', [0,0,1,1]);

</pre>
<p>The texts are fine but not for the image.</p>
<p>Supposedly it should be displaying like this (directly from html page)<br />
<a href="https://postimg.org/image/lge4hdvb9/" rel="nofollow ugc">https://postimg.org/image/lge4hdvb9/</a></p>
<p>but in MATLAB, it appeared like this one<br />
<a href="https://postimg.org/image/3rmdprjk5/" rel="nofollow ugc">https://postimg.org/image/3rmdprjk5/</a></p>
<p>All the src=&#8217;path&#8217; is correct.. But I have no idea on how to display the image in MATLAB&#8230; Any idea?</p>
<p>Regards,</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Antonio		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-375885</link>

		<dc:creator><![CDATA[Antonio]]></dc:creator>
		<pubDate>Fri, 06 May 2016 13:53:27 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-375885</guid>

					<description><![CDATA[Hello Yair,

Thanks for your tips and this web.

I have an easy question, I think. I&#039;ve created an edit box and placed a simple HTML text on it. I also have created a button to copy this formatted text to the clipboard when you push on it. But as we are working within the &#039;java space&#039; and the function &quot;get(hObject,&#039;String&#039;)&quot; no longer works, I have no clue on how to do it.]]></description>
			<content:encoded><![CDATA[<p>Hello Yair,</p>
<p>Thanks for your tips and this web.</p>
<p>I have an easy question, I think. I&#8217;ve created an edit box and placed a simple HTML text on it. I also have created a button to copy this formatted text to the clipboard when you push on it. But as we are working within the &#8216;java space&#8217; and the function &#8220;get(hObject,&#8217;String&#8217;)&#8221; no longer works, I have no clue on how to do it.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mario		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-370401</link>

		<dc:creator><![CDATA[Mario]]></dc:creator>
		<pubDate>Tue, 23 Feb 2016 10:16:13 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-370401</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-343684&quot;&gt;David M&lt;/a&gt;.

Yeah, I am also interested in that topic! :)]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-343684">David M</a>.</p>
<p>Yeah, I am also interested in that topic! 🙂</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-366998</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 07 Jan 2016 16:45:25 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-366998</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-366997&quot;&gt;Scott C&lt;/a&gt;.

@Scott - I think you are looking for this: http://undocumentedmatlab.com/blog/rich-contents-log-panel]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-366997">Scott C</a>.</p>
<p>@Scott &#8211; I think you are looking for this: <a href="http://undocumentedmatlab.com/blog/rich-contents-log-panel" rel="ugc">http://undocumentedmatlab.com/blog/rich-contents-log-panel</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Scott C		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-366997</link>

		<dc:creator><![CDATA[Scott C]]></dc:creator>
		<pubDate>Thu, 07 Jan 2016 16:43:13 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-366997</guid>

					<description><![CDATA[Hi Yair,

Thanks for the great ideas. 

I would like to create an enriched MATLAB listbox where each line can have its own icon, font style, and callback. 

Is this possible along the same lines as the edit box example above?]]></description>
			<content:encoded><![CDATA[<p>Hi Yair,</p>
<p>Thanks for the great ideas. </p>
<p>I would like to create an enriched MATLAB listbox where each line can have its own icon, font style, and callback. </p>
<p>Is this possible along the same lines as the edit box example above?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: David M		</title>
		<link>https://undocumentedmatlab.com/articles/rich-matlab-editbox-contents#comment-343684</link>

		<dc:creator><![CDATA[David M]]></dc:creator>
		<pubDate>Fri, 09 Jan 2015 21:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=944#comment-343684</guid>

					<description><![CDATA[Yair,

I wish to limit the number of characters a JTextPane can contain. Accordingly, I plan to implement a document filter, which will impose a max character limit of my choosing. (http://docs.oracle.com/javase/tutorial/uiswing/components/generaltext.html#filter)
&lt;pre lang=&quot;matlab&quot;&gt; 
jTextPane = javax.swing.JTextPane();
maxCharacters = 300;

import javax.swing.text.*
doc = jTextPane.getStyledDocument();
doc.setDocumentFilter();
% ...
% ...
% ...
&lt;/pre&gt;

Still, I am unable to connect the next step in the process; how do I add a documentFilter? NOTE: Matlab will not let me access javax.swing.text.DocumentFilter.FilterBypass, a necessary input.]]></description>
			<content:encoded><![CDATA[<p>Yair,</p>
<p>I wish to limit the number of characters a JTextPane can contain. Accordingly, I plan to implement a document filter, which will impose a max character limit of my choosing. (<a href="http://docs.oracle.com/javase/tutorial/uiswing/components/generaltext.html#filter" rel="nofollow ugc">http://docs.oracle.com/javase/tutorial/uiswing/components/generaltext.html#filter</a>)</p>
<pre lang="matlab"> 
jTextPane = javax.swing.JTextPane();
maxCharacters = 300;

import javax.swing.text.*
doc = jTextPane.getStyledDocument();
doc.setDocumentFilter();
% ...
% ...
% ...
</pre>
<p>Still, I am unable to connect the next step in the process; how do I add a documentFilter? NOTE: Matlab will not let me access javax.swing.text.DocumentFilter.FilterBypass, a necessary input.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
