<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://www.bytemycode.com/rssformat.xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>byteMyCode: Snippets for the jonathanstarrett</title>
		<link>http://www.bytemycode.com</link>
		<description>Snippets for this member.</description>
		<pubDate>Fri, 09 Jan 2009 19:34:55 +0000</pubDate>
		<copyright>1998-2009 </copyright>
		<language>en-us</language>
		<image>
		      <link>http://www.bytemycode.com</link>
		      <url>http://www.bytemycode.com/img/rss_title.gif</url>
		      <title>byteMyCode</title>
		</image>

	<item>
	<title>Create JComboBox Model From Enum</title>
	<link>http://www.bytemycode.com/snippets/snippet/482/</link>
	<comments>http://www.bytemycode.com/snippets/snippet/482/comments/</comments>
	<pubDate>Mon, 23 Oct 2006 17:35:26 +0000</pubDate>
	<dc:creator>jonathanstarrett</dc:creator>
	<category>"form input", Java, JComboBox</category>
	<guid isPermaLink="false">http://www.bytemycode.com/snippets/snippet/482/</guid>
	<description>
		<![CDATA[

			<img src="http://www.bytemycode.com/img/icon_calendar.gif" align="middle" class="icon" alt="Date Submitted" /> Mon. Oct. 23rd, 2006  5:35 PM			<br />
			<img src="http://www.bytemycode.com/img/icon_revision.gif" align="middle" class="icon" alt="Revision" /> <a href="http://www.bytemycode.com/snippets/snippet/482/revisions/">1</a>
			<br />
			<img src="http://www.bytemycode.com/img/rank_beginner.gif" align="middle" class="icon" alt="Beginner" /> <a href="http://www.bytemycode.com/members/member/jonathanstarrett/" title="Beginner">jonathanstarrett</a>
			<br />
			<img src="http://www.bytemycode.com/img/icon_tag.gif" align="middle" class="icon" alt="Tags" /> <a href="http://www.bytemycode.com/tags/tag/%22form+input%22">"form input"</a>&nbsp;|&nbsp;<a href="http://www.bytemycode.com/tags/tag/Java">Java</a>&nbsp;|&nbsp;<a href="http://www.bytemycode.com/tags/tag/JComboBox">JComboBox</a>			<br />
			<img src="http://www.bytemycode.com/img/icon_comments.gif" align="middle" class="icon" alt="Comments" /> <a href="http://www.bytemycode.com/snippets/snippet/482/comments/">0 comments</a>
			<br />
			<img src="http://www.bytemycode.com/img/icon_ranking.gif" align="middle" class="icon" alt="Ranking" /> 4
			<p>I was looking for an easy way to populate a combo box with strings taken from an enumeration, and also to be able to pull out Enum objects from the combo box. After some searching, I found EnumComboBoxModel on the JDesktop website, but was not able to find any code.<br /><br />Instead I came up with an easier solution that did not require me to define a new Model class, but instead uses javax.swing.DefaultComboBoxModel.<br /><br />Sorry for the disorganization of the code, but hopefully you get the idea.</p>
		]]>
	</description>
</item>
	</channel>
</rss>