<?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: Color selection components	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/color-selection-components/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/color-selection-components?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=color-selection-components</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Fri, 03 Mar 2017 19:28:04 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.3</generator>
	<item>
		<title>
		By: meade		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-401802</link>

		<dc:creator><![CDATA[meade]]></dc:creator>
		<pubDate>Fri, 03 Mar 2017 19:28:04 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-401802</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/color-selection-components#comment-400929&quot;&gt;Meade&lt;/a&gt;.

Yair, 

I figured out my request.  Posting it here for anyone else who may be curious.

Thanks again!
Meade
 
&lt;pre lang=&quot;matlab&quot;&gt;
 import com.mathworks.mlwidgets.graphics.ColorPicker
 cp = ColorPicker(ColorPicker.AUTO, ColorPicker.LINE_ICON, &#039;&#039;);
 [jcp,hcontainer] = javacomponent(cp,[],gcf);
 
 % !! Here&#039;s the key bit... This will trigger when user picks a color &#038; selects &quot;OK&quot; in widget
 set(jcp, &#039;ItemStateChangedCallback&#039;, {@MyCallback,gcf})


 function MyCallback(hObj,evt,hFigure)
      color = cp.getValue;  % a java.awt.Color object % This should be within the callback
      color = cp.getValue.getColorComponents([])&#039; * 255;   % an [R,G,B] array of values
      % Do something with the color
 end %MyCallback
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/color-selection-components#comment-400929">Meade</a>.</p>
<p>Yair, </p>
<p>I figured out my request.  Posting it here for anyone else who may be curious.</p>
<p>Thanks again!<br />
Meade</p>
<pre lang="matlab">
 import com.mathworks.mlwidgets.graphics.ColorPicker
 cp = ColorPicker(ColorPicker.AUTO, ColorPicker.LINE_ICON, '');
 [jcp,hcontainer] = javacomponent(cp,[],gcf);
 
 % !! Here's the key bit... This will trigger when user picks a color &amp; selects "OK" in widget
 set(jcp, 'ItemStateChangedCallback', {@MyCallback,gcf})


 function MyCallback(hObj,evt,hFigure)
      color = cp.getValue;  % a java.awt.Color object % This should be within the callback
      color = cp.getValue.getColorComponents([])' * 255;   % an [R,G,B] array of values
      % Do something with the color
 end %MyCallback
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Meade		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-400929</link>

		<dc:creator><![CDATA[Meade]]></dc:creator>
		<pubDate>Wed, 22 Feb 2017 16:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-400929</guid>

					<description><![CDATA[Yair,

Another super useful post I&#039;m just now finding!

I have embedded this color picker within a context menu of a GUI I&#039;ve built. 
My question is this:
Is it possible to trigger a callback when the user clicks &#039;OK&#039; in the widget?  
Using the code snippet you provided for @Red Kim, hopefully my intention is clear.

Thanks so much for all the great insights.
Best,
meade

&lt;pre lang=&quot;matlab&quot;&gt;
import com.mathworks.mlwidgets.graphics.ColorPicker
cp = ColorPicker(ColorPicker.AUTO, ColorPicker.LINE_ICON, &#039;&#039;);
[jcp,hcontainer] = javacomponent(cp,[],gcf);   % Need to trigger callback on selection here!

% function MyCallback(hObj,evt)
color = cp.getValue;  % a java.awt.Color object % This should be within the callback
color = cp.getValue.getColorComponents([])&#039; * 255;   % an [R,G,B] array of values
% Do something with the color
% end %MyCallback
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>Yair,</p>
<p>Another super useful post I&#8217;m just now finding!</p>
<p>I have embedded this color picker within a context menu of a GUI I&#8217;ve built.<br />
My question is this:<br />
Is it possible to trigger a callback when the user clicks &#8216;OK&#8217; in the widget?<br />
Using the code snippet you provided for @Red Kim, hopefully my intention is clear.</p>
<p>Thanks so much for all the great insights.<br />
Best,<br />
meade</p>
<pre lang="matlab">
import com.mathworks.mlwidgets.graphics.ColorPicker
cp = ColorPicker(ColorPicker.AUTO, ColorPicker.LINE_ICON, '');
[jcp,hcontainer] = javacomponent(cp,[],gcf);   % Need to trigger callback on selection here!

% function MyCallback(hObj,evt)
color = cp.getValue;  % a java.awt.Color object % This should be within the callback
color = cp.getValue.getColorComponents([])' * 255;   % an [R,G,B] array of values
% Do something with the color
% end %MyCallback
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-358876</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 13 Oct 2015 19:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-358876</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/color-selection-components#comment-358858&quot;&gt;Paul&lt;/a&gt;.

@Paul - you can use the following object methods to retrieve the &lt;code&gt;com.mathworks.beans.editors.ColorPicker&lt;/code&gt;&#039;s selected color:
&lt;i&gt;
 * getBlue()  % returns int
 * getGreen()  % returns int
 * getRed()  % returns int
 * getSelectedColor()  % returns java.awt.Color 
&lt;/i&gt;

Red Kim referred to a different &lt;code&gt;ColorPicker&lt;/code&gt; class (that happens to have the same class name), but it&#039;s a different class in a different package so of course it has different behavior.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/color-selection-components#comment-358858">Paul</a>.</p>
<p>@Paul &#8211; you can use the following object methods to retrieve the <code>com.mathworks.beans.editors.ColorPicker</code>&#8216;s selected color:<br />
<i><br />
 * getBlue()  % returns int<br />
 * getGreen()  % returns int<br />
 * getRed()  % returns int<br />
 * getSelectedColor()  % returns java.awt.Color<br />
</i></p>
<p>Red Kim referred to a different <code>ColorPicker</code> class (that happens to have the same class name), but it&#8217;s a different class in a different package so of course it has different behavior.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Paul		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-358858</link>

		<dc:creator><![CDATA[Paul]]></dc:creator>
		<pubDate>Tue, 13 Oct 2015 11:48:12 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-358858</guid>

					<description><![CDATA[Hi, I find your advice absolutely wonderful.
However I can&#039;t find a way to retrieve colour information from the &lt;code&gt;com.mathworks.beans.editors.ColorPicker&lt;/code&gt; object (used as in example), even with your Red Kim answer.
Would you have any idea why ?]]></description>
			<content:encoded><![CDATA[<p>Hi, I find your advice absolutely wonderful.<br />
However I can&#8217;t find a way to retrieve colour information from the <code>com.mathworks.beans.editors.ColorPicker</code> object (used as in example), even with your Red Kim answer.<br />
Would you have any idea why ?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-327292</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 02 Jul 2014 16:51:45 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-327292</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/color-selection-components#comment-327224&quot;&gt;Ronin&lt;/a&gt;.

@ronin - I am not aware of a way to do this.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/color-selection-components#comment-327224">Ronin</a>.</p>
<p>@ronin &#8211; I am not aware of a way to do this.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ronin		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-327224</link>

		<dc:creator><![CDATA[Ronin]]></dc:creator>
		<pubDate>Tue, 01 Jul 2014 09:14:39 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-327224</guid>

					<description><![CDATA[Is it possible with some script or ui to edit the predefined colors that all the above mentioned color-selection tools seem to have in common? I personally dont ever use any other colors than given in the first 4 lines (white to black, red1... , red2..., and the one with green in it ). So the last 5 lines are just crap. Id really love to change them into more useful colors.

Thanks in advance]]></description>
			<content:encoded><![CDATA[<p>Is it possible with some script or ui to edit the predefined colors that all the above mentioned color-selection tools seem to have in common? I personally dont ever use any other colors than given in the first 4 lines (white to black, red1&#8230; , red2&#8230;, and the one with green in it ). So the last 5 lines are just crap. Id really love to change them into more useful colors.</p>
<p>Thanks in advance</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Red Kim		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-85993</link>

		<dc:creator><![CDATA[Red Kim]]></dc:creator>
		<pubDate>Mon, 14 May 2012 10:50:18 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-85993</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/color-selection-components#comment-85966&quot;&gt;Red Kim&lt;/a&gt;.

Thank you so much!!
It&#039;s working now!
Your amazing guy!!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/color-selection-components#comment-85966">Red Kim</a>.</p>
<p>Thank you so much!!<br />
It&#8217;s working now!<br />
Your amazing guy!!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-85967</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Mon, 14 May 2012 06:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-85967</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/color-selection-components#comment-85966&quot;&gt;Red Kim&lt;/a&gt;.

@Kim - 

&lt;pre lang=&#039;matlab&#039;&gt;
import com.mathworks.mlwidgets.graphics.ColorPicker
cp = ColorPicker(ColorPicker.AUTO, ColorPicker.LINE_ICON, &#039;&#039;);
[jcp,hcontainer] = javacomponent(cp,[],gcf);
color = cp.getValue;  % a java.awt.Color object
color = cp.getValue.getColorComponents([])&#039; * 255;   % an [R,G,B] array of values
&lt;/pre&gt;

More information about &lt;code&gt;ColorPicker&lt;/code&gt;, including its options and icons styles, can be found in section 5.4.1 of my &lt;a href=&quot;http://undocumentedmatlab.com-java-book/&quot; rel=&quot;nofollow&quot;&gt;Matlab-Java book&lt;/a&gt;.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/color-selection-components#comment-85966">Red Kim</a>.</p>
<p>@Kim &#8211; </p>
<pre lang='matlab'>
import com.mathworks.mlwidgets.graphics.ColorPicker
cp = ColorPicker(ColorPicker.AUTO, ColorPicker.LINE_ICON, '');
[jcp,hcontainer] = javacomponent(cp,[],gcf);
color = cp.getValue;  % a java.awt.Color object
color = cp.getValue.getColorComponents([])' * 255;   % an [R,G,B] array of values
</pre>
<p>More information about <code>ColorPicker</code>, including its options and icons styles, can be found in section 5.4.1 of my <a href="http://undocumentedmatlab.com-java-book/" rel="nofollow">Matlab-Java book</a>.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Red Kim		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-85966</link>

		<dc:creator><![CDATA[Red Kim]]></dc:creator>
		<pubDate>Mon, 14 May 2012 06:29:08 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-85966</guid>

					<description><![CDATA[Hi. 
I&#039;m always find information in your Blog.
ans also read this page. but I don&#039;t know how to get color info
in &quot;com.mathworks.mlwidgets.graphics.ColorPicker&quot;.
I&#039;d like get color info same to get &quot;uigetcolor&quot;.
How to get it?
and I&#039;d like set default color... 
It like System Test Tool box &quot;Plot - General&quot;.]]></description>
			<content:encoded><![CDATA[<p>Hi.<br />
I&#8217;m always find information in your Blog.<br />
ans also read this page. but I don&#8217;t know how to get color info<br />
in &#8220;com.mathworks.mlwidgets.graphics.ColorPicker&#8221;.<br />
I&#8217;d like get color info same to get &#8220;uigetcolor&#8221;.<br />
How to get it?<br />
and I&#8217;d like set default color&#8230;<br />
It like System Test Tool box &#8220;Plot &#8211; General&#8221;.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jesse dziedzic		</title>
		<link>https://undocumentedmatlab.com/articles/color-selection-components#comment-59937</link>

		<dc:creator><![CDATA[Jesse dziedzic]]></dc:creator>
		<pubDate>Thu, 20 Oct 2011 15:47:14 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2322#comment-59937</guid>

					<description><![CDATA[Wonderful post!!]]></description>
			<content:encoded><![CDATA[<p>Wonderful post!!</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
