<?xml version="1.0" encoding="utf-8" ?><?xml-stylesheet type="text/xsl" href="http://www.daniweb.com/js/rss.xsl"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community
			 - Software Development			Code Snippets					</title>
		<link>http://www.daniweb.com/software-development/code/_/2</link>
		<description>Our Software Development forum category encompasses topics related to application programming and software design. When posting programming code, please make sure it is formatted appropriately. Also, to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.</description>
		<language>en-US</language>
		<ttl>60</ttl>
		<!-- PubSubHubbub Discovery -->
		<link rel="hub" href="http://daniweb.superfeedr.com/" xmlns="http://www.w3.org/2005/Atom" />
		<link rel="self" href="http://www.daniweb.com/rss/pull/2/code" xmlns="http://www.w3.org/2005/Atom" />
		<!-- End Of PubSubHubbub Discovery -->
				<item>
			<title>Draw phases of the moon On a form</title>
			<link>http://www.daniweb.com/software-development/csharp/code/454979/draw-phases-of-the-moon-on-a-form</link>
			<pubDate>Mon, 20 May 2013 11:13:14 +0000</pubDate>
			<description>Lately, I was reading [this snippet](http://www.daniweb.com/software-development/python/code/453788/moon-phase-at-a-given-date-python) by vegaseat. I thought, why not do it in C#? But I would also like to add lattitude and logitude in the celestial calculations and draw a picture of the moon at that moment and location. Now the calculations can get a bit involved ...</description>
			<content:encoded><![CDATA[ <p>Lately, I was reading <a href="http://www.daniweb.com/software-development/python/code/453788/moon-phase-at-a-given-date-python" rel="nofollow">this snippet</a> by vegaseat. I thought, why not do it in C#? But I would also like to add lattitude and logitude in the celestial calculations and draw a picture of the moon at that moment and location. Now the calculations can get a bit involved but are doable. So first I did a little try out about the drawing of a moon phase picture. Code for the main drawing method is given here. Just call it from a Paint event. A litte project file for a test app is included in a zip file as is a picture of how it looks.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/csharp/61">C#</category>
			<dc:creator>ddanbe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/csharp/code/454979/draw-phases-of-the-moon-on-a-form</guid>
		</item>
				<item>
			<title>Find a String in Several Files at a ago</title>
			<link>http://www.daniweb.com/software-development/perl/code/454868/find-a-string-in-several-files-at-a-ago</link>
			<pubDate>Sat, 18 May 2013 12:41:45 +0000</pubDate>
			<description>I really got bored and tired of trying to find or remember some codes usage in so many files saved on my system, when it was needed. So, I called 'Monsieur' perl for help, hacking together some codes which works great for me and solve my problem of boredom. You ...</description>
			<content:encoded><![CDATA[ <p>I really got bored and tired of trying to find or remember some codes usage in so many files saved on my system, when it was needed.</p>

<p>So, I called 'Monsieur' perl for help, hacking together some codes which works great for me and solve my problem of boredom.</p>

<p>You run the code from the CLI, like so: perl &lt;perl_script.pl&gt; &lt;-l | -location&gt; &lt;-s | -search &gt;<br />
 E.g. perl search_doc.pl -l Desktop/Doc_file -s Win32::OLE</p>

<ol><li>Your perl file : search_doc.pl</li>
<li>Your location  : -l Desktop/Doc_file or -location Desktop/Doc_file</li>
<li>Your search string: -s Win32::OLE or -search Win32::OLE</li>
</ol>

<p>You can decide to use <code>--l</code> or <code>--search</code> as you want.</p>

<p>Please feel free to add comments, to ask question and use as you want.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/perl/112">Perl</category>
			<dc:creator>2teez</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/perl/code/454868/find-a-string-in-several-files-at-a-ago</guid>
		</item>
				<item>
			<title>Let PyGame play your MIDI or MP3 files</title>
			<link>http://www.daniweb.com/software-development/python/code/454835/let-pygame-play-your-midi-or-mp3-files</link>
			<pubDate>Fri, 17 May 2013 16:12:24 +0000</pubDate>
			<description>Just a code sample that allows you to play your midi or mp3 music files with Python and module pygame.</description>
			<content:encoded><![CDATA[ <p>Just a code sample that allows you to play your midi or mp3 music files with Python and module pygame.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/454835/let-pygame-play-your-midi-or-mp3-files</guid>
		</item>
				<item>
			<title>Save a PyGame drawing</title>
			<link>http://www.daniweb.com/software-development/python/code/454765/save-a-pygame-drawing</link>
			<pubDate>Thu, 16 May 2013 17:48:42 +0000</pubDate>
			<description>You can draw a number of shapes directly on the PyGame window, and then save the drawing to an image file.</description>
			<content:encoded><![CDATA[ <p>You can draw a number of shapes directly on the PyGame window, and then save the drawing to an image file.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/454765/save-a-pygame-drawing</guid>
		</item>
				<item>
			<title>Basic for-loops -fixed</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/code/454705/basic-for-loops-fixed</link>
			<pubDate>Wed, 15 May 2013 23:33:59 +0000</pubDate>
			<description>I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. ...</description>
			<content:encoded><![CDATA[ <p>I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. Here are some very basic examples on how to do for-loops in BASH.</p>

<p>Edit: Fixed per Watael's suggestions.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/code/454705/basic-for-loops-fixed</guid>
		</item>
				<item>
			<title>Basic for-loops with strings, arrays, file names, and arguments.</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/code/454702/basic-for-loops-with-strings-arrays-file-names-and-arguments</link>
			<pubDate>Wed, 15 May 2013 22:36:22 +0000</pubDate>
			<description>I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. ...</description>
			<content:encoded><![CDATA[ <p>I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. Here are some very basic examples on how to do for-loops in BASH.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/code/454702/basic-for-loops-with-strings-arrays-file-names-and-arguments</guid>
		</item>
				<item>
			<title>Show color code chart in your terminal</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/code/454700/show-color-code-chart-in-your-terminal</link>
			<pubDate>Wed, 15 May 2013 22:18:17 +0000</pubDate>
			<description>This is another useful script I came across. It prints a color-code chart in your terminal. It can help you find the color-code you are looking for, or view the current color-scheme you are using (people use it on reddit/r/unixporn to show off their system's theme, I use it to ...</description>
			<content:encoded><![CDATA[ <p>This is another useful script I came across. It prints a color-code chart in your terminal. It can help you find the color-code you are looking for, or view the current color-scheme you are using (people use it on reddit/r/unixporn to show off their system's theme, I use it to grab color codes).</p>

<p>I figure someone may get some use out of this, and there aren't many "Shell Scripting" code-snippets, so I'll put it here.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/code/454700/show-color-code-chart-in-your-terminal</guid>
		</item>
				<item>
			<title>The Matrix in your terminal</title>
			<link>http://www.daniweb.com/software-development/shell-scripting/code/454699/the-matrix-in-your-terminal</link>
			<pubDate>Wed, 15 May 2013 22:09:21 +0000</pubDate>
			<description>I didn't write this, the credits are in the code. It's a code-golf version, and I'm sorry about that. I am trying to 'decode' it but I don't have the skills, so the 'decoded' version doesn't have the right colors. This is an example of what you can do with ...</description>
			<content:encoded><![CDATA[ <p>I didn't write this, the credits are in the code. It's a code-golf version, and I'm sorry about that. I am trying to 'decode' it but I don't have the skills, so the 'decoded' version doesn't have the right colors.</p>

<p>This is an example of what you can do with BASH, or possibly other shells, and it's just a neat thing to see. So I offer this up for your amusement, I've tested it and combed through it to make sure there's no hidden tricks. As far as I can tell it only uses a few commands like <code>echo</code>, <code>printf</code>, <code>sleep</code>, and <code>eval</code>, with <code>if</code> statements and color codes.</p>

<p><strong>The Matrix</strong> (<em>matrix.sh</em>):</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/shell-scripting/113">Shell Scripting</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/shell-scripting/code/454699/the-matrix-in-your-terminal</guid>
		</item>
				<item>
			<title>How to use docopt to parse command-line options</title>
			<link>http://www.daniweb.com/software-development/python/code/454621/how-to-use-docopt-to-parse-command-line-options</link>
			<pubDate>Tue, 14 May 2013 22:43:48 +0000</pubDate>
			<description>I just wanted to show the basic usage of docopt, a module that makes parsing command-line arguments so much easier. I'm not affiliated with the creators of docopt, but I'm certainly thankful for their work and happy to post this little snippet. I will point you to [docopt.org](http://docopt.org) for more ...</description>
			<content:encoded><![CDATA[ <p>I just wanted to show the basic usage of docopt, a module that makes parsing command-line arguments so much easier. I'm not affiliated with the creators of docopt, but I'm certainly thankful for their work and happy to post this little snippet. I will point you to <a href="http://docopt.org" rel="nofollow">docopt.org</a> for more information because there is so much more you can do with this module, that I'm not showing you here. Watch the video, it was an eye-opener for me. Also, if you'd like to install docopt you can go to their <a href="https://github.com/docopt/docopt" rel="nofollow">github repo</a> to download and install it.</p>

<p>Try running this script in different ways to see the results, any invalid arguments will kick the user out to a Usage message (which also happens to be the way docopt recognizes valid or invalid arguments, awesome). The -h and --help flags are automagically recognized and used, so no code for them needs to be written:</p>

<pre><code class="language-py">./docopt_example.py -h
./docopt_example.py myrequiredargument
./docopt_example.py myrequiredargument -f
./docopt_example.py myrepeatingarg1 myrepeatingarg2 myrepeatingarg3
</code></pre>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>chriswelborn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/454621/how-to-use-docopt-to-parse-command-line-options</guid>
		</item>
				<item>
			<title>Solving the cubic equation using the Complex struct</title>
			<link>http://www.daniweb.com/software-development/csharp/code/454493/solving-the-cubic-equation-using-the-complex-struct</link>
			<pubDate>Mon, 13 May 2013 09:59:44 +0000</pubDate>
			<description>Complex numbers are seldom used in daily life, altough you could say that every real number is complex, but with the imaginary part equal to zero. And btw. &quot;complex&quot; is a bit of a misnomer, perhaps we should call them &quot;easies&quot;, because often they make it easier to perform certain ...</description>
			<content:encoded><![CDATA[ <p>Complex numbers are seldom used in daily life, altough you could say that every real number is complex, but with the imaginary part equal to zero. And btw. "complex" is a bit of a misnomer, perhaps we should call them "easies", because often they make it easier to perform certain math tasks.<br />
It all started in Italy, 13th century or so when mathematicians where trying to solve quadratic and cubic equations. Here is my solution in C# of the cubic. I used the rules found in wikipedia.<br />
Included a zip file with a small formsapplication that exercises the method given here.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/csharp/61">C#</category>
			<dc:creator>ddanbe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/csharp/code/454493/solving-the-cubic-equation-using-the-complex-struct</guid>
		</item>
				<item>
			<title>A Simple Login Form for C#</title>
			<link>http://www.daniweb.com/software-development/csharp/code/454432/a-simple-login-form-for-c</link>
			<pubDate>Sun, 12 May 2013 04:06:21 +0000</pubDate>
			<description>This is a very simple login form. I set it up so that the form won't close until it's cancelled or a valid username and password are entered. I chained the check for the username and the check for the password, so that if the username doesn't pass the password ...</description>
			<content:encoded><![CDATA[ <p>This is a very simple login form.  I set it up so that the form won't close until it's cancelled or a valid username and password are entered. I chained the check for the username and the check for the password, so that if the username doesn't pass the password isn't checked and the password check returns false.  The code is simple enough that that is easily changed</p>

<p>I included a picturebox for a logo.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/csharp/61">C#</category>
			<dc:creator>tinstaafl</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/csharp/code/454432/a-simple-login-form-for-c</guid>
		</item>
				<item>
			<title>Moon Phase at a given date (Python)</title>
			<link>http://www.daniweb.com/software-development/python/code/453788/moon-phase-at-a-given-date-python</link>
			<pubDate>Thu, 02 May 2013 21:19:30 +0000</pubDate>
			<description>For those who are afraid of lycanthropes and full moons, here is a way to figure out the phase of the moon.</description>
			<content:encoded><![CDATA[ <p>For those who are afraid of lycanthropes and full moons, here is a way to figure out the phase of the moon.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/453788/moon-phase-at-a-given-date-python</guid>
		</item>
				<item>
			<title>Making a DataGridView look like a sudoku board</title>
			<link>http://www.daniweb.com/software-development/csharp/code/453445/making-a-datagridview-look-like-a-sudoku-board</link>
			<pubDate>Sat, 27 Apr 2013 10:09:57 +0000</pubDate>
			<description>Btw. this is not a sudoku solver. To gain a deeper insight into the workings of the DataGridView beast (but I begin to love and appreciate it) I decided to make myself a sudoku layout with it. Start a forms app. Make the form a bit bigger and fill in ...</description>
			<content:encoded><![CDATA[ <p>Btw. this is not a sudoku solver.<br />
To gain a deeper insight into the workings of the DataGridView beast (but I begin to love and appreciate it) I decided to make myself a sudoku layout with it.<br />
Start a forms app. Make the form a bit bigger and fill in the code. I did most of it in the load event of the form. It was fun to do, but the real fun starts now:<br />
How to handle the myriad of events of the DataGridView to fill up the board with digits? For the moment I can fill in only one character in a cell(see line 47),but I can also input letters. How to avoid this?<br />
How can I jump the inputfield over an already filled in digit when I push an arrowkey? Etc. etc.<br />
Let you know when I finished that in a couple of months or so. <strong>:o)</strong></p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/csharp/61">C#</category>
			<dc:creator>ddanbe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/csharp/code/453445/making-a-datagridview-look-like-a-sudoku-board</guid>
		</item>
				<item>
			<title>Having trouble with doublyLinkedList</title>
			<link>http://www.daniweb.com/software-development/cpp/code/452978/having-trouble-with-doublylinkedlist</link>
			<pubDate>Sun, 21 Apr 2013 20:12:06 +0000</pubDate>
			<description>1. Write the definitions of the following methods for the class doublyLinkedList a. copyList b. copy constructor c. function to overload the assignment operator d. destructor Also, write a program to test the copy constructor and the assignment operator methods of the class doublyLinkedList.</description>
			<content:encoded><![CDATA[ <ol><li>Write the definitions of the following methods for the class doublyLinkedList<br />
a.  copyList<br />
b.  copy constructor<br />
c.  function to overload the assignment operator<br />
d.  destructor</li>
</ol>

<p>Also, write a program to test the copy constructor and the assignment operator methods of the class doublyLinkedList.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/cpp/8">C++</category>
			<dc:creator>ddm</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/cpp/code/452978/having-trouble-with-doublylinkedlist</guid>
		</item>
				<item>
			<title>Add a row with totals to a DataGridView</title>
			<link>http://www.daniweb.com/software-development/csharp/code/452633/add-a-row-with-totals-to-a-datagridview</link>
			<pubDate>Tue, 16 Apr 2013 18:34:32 +0000</pubDate>
			<description>Well, start a new forms application from VS. In design mode, drop a DataGridView and a Button on the form and fill in the code. The button clickhandler will add an extra totals row to the datagrid. Here it will keep adding and totaling, which is of course meaningless, but ...</description>
			<content:encoded><![CDATA[ <p>Well, start a new forms application from VS.<br />
In design mode, drop a DataGridView and a Button on the form and fill in the code.<br />
The button clickhandler will add an extra totals row to the datagrid.<br />
Here it will keep adding and totaling, which is of course meaningless, but it's just example code.<br />
Enjoy.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/csharp/61">C#</category>
			<dc:creator>ddanbe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/csharp/code/452633/add-a-row-with-totals-to-a-datagridview</guid>
		</item>
				<item>
			<title>Get multiple file names (PyQT/PySide)</title>
			<link>http://www.daniweb.com/software-development/python/code/452624/get-multiple-file-names-pyqtpyside</link>
			<pubDate>Tue, 16 Apr 2013 15:27:56 +0000</pubDate>
			<description>A simple test of PySide's QFileDialog widget and its method getOpenFileNames. Use method getOpenFileName if you want just one file name.</description>
			<content:encoded><![CDATA[ <p>A simple test of PySide's QFileDialog widget and its method getOpenFileNames.  Use method getOpenFileName if you want just one file name.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/452624/get-multiple-file-names-pyqtpyside</guid>
		</item>
				<item>
			<title>Simple line graph charting</title>
			<link>http://www.daniweb.com/software-development/csharp/code/451281/simple-line-graph-charting</link>
			<pubDate>Sat, 30 Mar 2013 15:13:18 +0000</pubDate>
			<description>It was tinstaafl who put me on the right track. [Click Here](http://www.daniweb.com/software-development/csharp/threads/450463/graph-plotter) I did not know that .NET as of VS 2010 had a charting control! OK, let’s get started! But the learning curve, is as always, a bit steep. MSDN does not seem to provide too much code, so ...</description>
			<content:encoded><![CDATA[ <p>It was tinstaafl who put me on the right track. <a href="http://www.daniweb.com/software-development/csharp/threads/450463/graph-plotter" rel="nofollow">Click Here</a> I did not know that .NET as of VS 2010 had a charting control!<br />
OK, let’s get started! But the learning curve, is as always, a bit steep. MSDN does not seem to provide too much code, so I looked around on the net, but here they often make use of special graphics packages. So not much help either… After some fumbling around, I came up with the following easy ( I think ) code. Just start up a new windows form app and fill in the provided code in the Form.cs file. Enjoy!</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/csharp/61">C#</category>
			<dc:creator>ddanbe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/csharp/code/451281/simple-line-graph-charting</guid>
		</item>
				<item>
			<title>Projectile Motion (Python)</title>
			<link>http://www.daniweb.com/software-development/python/code/450564/projectile-motion-python</link>
			<pubDate>Wed, 20 Mar 2013 16:22:38 +0000</pubDate>
			<description>This example calculates timed x, y points of a projectile motion that can be used for plotting or other calculations.</description>
			<content:encoded><![CDATA[ <p>This example calculates timed x, y points of a projectile motion that can be used for plotting or other calculations.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/450564/projectile-motion-python</guid>
		</item>
				<item>
			<title>Resize an Image from the Web (PIL, Tkinter)</title>
			<link>http://www.daniweb.com/software-development/python/code/450373/resize-an-image-from-the-web-pil-tkinter</link>
			<pubDate>Mon, 18 Mar 2013 19:46:35 +0000</pubDate>
			<description>Similiar to the snippet posted at: http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter but this time we use PIL to resize the image from the internet keeping its aspect ratio to fit a specific display area/box.</description>
			<content:encoded><![CDATA[ <p>Similiar to the snippet posted at:<br />
<a href="http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter" rel="nofollow">http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter</a><br />
but this time we use PIL to resize the image from the internet keeping its aspect ratio to fit a specific display area/box.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/450373/resize-an-image-from-the-web-pil-tkinter</guid>
		</item>
				<item>
			<title>AutoCompletion For JTextComponents</title>
			<link>http://www.daniweb.com/software-development/java/code/449798/autocompletion-for-jtextcomponents</link>
			<pubDate>Mon, 11 Mar 2013 14:51:40 +0000</pubDate>
			<description>I have seen many questions on autocompeletion for *java text components* like `JTextField` `JTextArea` `JTextEditorPane` etc. There are not many options either: 1) 3rd party library (like SwingX) 2) DIY (i.e using `DocumentListener`, `JWindow` with `JLabel` etc and a few requestFocusInWindow calls) I chose number 2 and put the code ...</description>
			<content:encoded><![CDATA[ <p>I have seen many questions on autocompeletion for <em>java text components</em> like <code>JTextField</code> <code>JTextArea</code> <code>JTextEditorPane</code> etc.</p>

<p>There are not many options either:</p>

<p>1) 3rd party library (like SwingX)<br />
2) DIY (i.e using <code>DocumentListener</code>, <code>JWindow</code> with <code>JLabel</code> etc and a few requestFocusInWindow calls)</p>

<p>I chose number 2 and put the code up here for others to have a working foundation that can be improved to your needs.</p>

<p>Basically you would just make sure the <code>AutoSuggestor</code> class is within package hierarchy than you would do something like:</p>

<pre><code class="language-java">        //create JTextComponent that we want to make as AutoSuggestor
        //JTextField f = new JTextField(10);
        JTextArea f = new JTextArea(10, 10);
        //JEditorPane f = new JEditorPane();

        //create words for dictionary could also use null as parameter for AutoSuggestor(..,..,null,..,..,..,..) and than call AutoSuggestor#setDictionary after AutoSuggestr insatnce has been created
        ArrayList&lt;String&gt; words = new ArrayList&lt;&gt;();
        words.add("hello");
        words.add("heritage");
        words.add("happiness");
        words.add("goodbye");
        words.add("cruel");
        words.add("car");
        words.add("war");
        words.add("will");
        words.add("world");
        words.add("wall");

        AutoSuggestor autoSuggestor = new AutoSuggestor(f, frame, words, Color.WHITE.brighter(), Color.BLUE, Color.RED, 0.75f);
</code></pre>

<p>A suggestion cna be clicked with the mouse or alternatively the down key can be use to traverse suggestions and the textcomponent</p>

<p><code>JTextField</code> pop up window will be shown under the component:</p>

<p><img src="/attachments/fetch/L2ltYWdlcy9hdHRhY2htZW50cy8zLzhiNDFlN2QxYzQ2MjdiOGQ0MjQ4ZDUzZGY2MjkwN2UxLnBuZw%3D%3D/202" alt="8b41e7d1c4627b8d4248d53df62907e1" title="align-center" /></p>

<p>while <code>JTextArea</code> and any other <code>JTextComponent</code>s will have it visible under the Carets current position:<br /><img src="/attachments/fetch/L2ltYWdlcy9hdHRhY2htZW50cy8zL2I1MDAxMmM5ODc2NWM1N2E0ZWQxYWM0ODhlMDZkYjM1LnBuZw%3D%3D/179" alt="b50012c98765c57a4ed1ac488e06db35" title="align-center" /></p>

<p>Hope it helps others.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/java/9">Java</category>
			<dc:creator>DavidKroukamp</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/java/code/449798/autocompletion-for-jtextcomponents</guid>
		</item>
				<item>
			<title>Simple Wrapper for Printing Text in .net</title>
			<link>http://www.daniweb.com/software-development/code/449721/simple-wrapper-for-printing-text-in-.net</link>
			<pubDate>Sun, 10 Mar 2013 20:46:55 +0000</pubDate>
			<description>Here's a simple wrapper for printing text. Built as a class library, this can be used in any .net application. This has automatic word wrapping. I figured that using the new constructor to accept different parameters would easily allow for printing different documents with different settings. I included Name, Font, ...</description>
			<content:encoded><![CDATA[ <p>Here's a simple wrapper for printing text.  Built as a class library, this can be used in any .net application.  This has automatic word wrapping.  I figured that using the new constructor to accept different parameters would  easily allow for printing different documents with different settings.  I included Name, Font, and Landscape, but the structure is quite simple and can easily be adapted to include or exclude any property or setting.</p>

<p>Usage is quite simple, build a string using linebreaks if needed(C#-'\n', VB-vbNewLine), declare a new PrintDoc, then call the Print() method.</p>

<pre><code>//C#
PrintDoc pd = new PrintDoc(MyString);
pd.Print();

'VB
Dim pd as New PrintDoc(MyString)
pd.Print()
</code></pre>

<p>Options include adding a Document name to the top of the printout, using a different font, or using Landscape orientation.  The options are included as overloads, Landscape is optional in each overload, when declaring the new PrintDoc.</p>

<p>Hope someone can find this useful.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/2">Software Development</category>
			<dc:creator>tinstaafl</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/code/449721/simple-wrapper-for-printing-text-in-.net</guid>
		</item>
				<item>
			<title>Mathematical Expression Evaluator</title>
			<link>http://www.daniweb.com/software-development/java/code/449049/mathematical-expression-evaluator</link>
			<pubDate>Sat, 02 Mar 2013 04:34:27 +0000</pubDate>
			<description>The above code computes the value of a mathematical expression supplied at command line by using the concept of converting infix to postfix,then evaluating the postfix expression. Any comments are appreciated.</description>
			<content:encoded><![CDATA[ <p>The above code computes the value of a mathematical expression supplied at command line by using the concept of converting infix to postfix,then evaluating the postfix expression. Any comments are appreciated.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/java/9">Java</category>
			<dc:creator>delta_frost</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/java/code/449049/mathematical-expression-evaluator</guid>
		</item>
				<item>
			<title>Display an Image from the Web (Tkinter)</title>
			<link>http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter</link>
			<pubDate>Fri, 01 Mar 2013 21:48:03 +0000</pubDate>
			<description>Simple code to show you how to display an image from a Web URL using the Tkinter Python GUI toolkit, the Python Image Library (PIL) and the data_stream created with io.BytesIO().</description>
			<content:encoded><![CDATA[ <p>Simple code to show you how to display an image from a Web URL using the Tkinter Python GUI toolkit, the Python Image Library (PIL) and the data_stream created with io.BytesIO().</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter</guid>
		</item>
				<item>
			<title>Progress of a Bubble Sort (C)</title>
			<link>http://www.daniweb.com/software-development/c/code/449023/progress-of-a-bubble-sort-c</link>
			<pubDate>Fri, 01 Mar 2013 17:36:39 +0000</pubDate>
			<description>The bubble sort is slow and I thought it would be interesting to visualize the progress as it sorts an array of integers.</description>
			<content:encoded><![CDATA[ <p>The bubble sort is slow and I thought it would be interesting to visualize the progress as it sorts an array of integers.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/c/118">C</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/c/code/449023/progress-of-a-bubble-sort-c</guid>
		</item>
				<item>
			<title>Number of Permutations (Python)</title>
			<link>http://www.daniweb.com/software-development/python/code/448888/number-of-permutations-python</link>
			<pubDate>Wed, 27 Feb 2013 22:50:34 +0000</pubDate>
			<description>This snippet allows you to find the number of ordered permutations of items taken from a population of known size. It uses the well know algorithm with factorials. For very large populations you may want to use an approximation of factorials.</description>
			<content:encoded><![CDATA[ <p>This snippet allows you to find the number of ordered permutations of items taken from a population of known size.  It uses the well know algorithm with factorials.  For very large populations you may want to use an approximation of factorials.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/448888/number-of-permutations-python</guid>
		</item>
				<item>
			<title>Number of Combinations (Python)</title>
			<link>http://www.daniweb.com/software-development/python/code/448886/number-of-combinations-python</link>
			<pubDate>Wed, 27 Feb 2013 22:34:22 +0000</pubDate>
			<description>If you want to know the number of combinations of x things taken n at a time, you can use the Python module gmpy. The module gmpy is a C-coded Python extension module that supports fast multiple-precision arithmetic, very handy if x things reach a large number.</description>
			<content:encoded><![CDATA[ <p>If you want to know the number of combinations of x things taken n at a time, you can use the Python module gmpy. The module gmpy is a C-coded Python extension module that supports fast multiple-precision arithmetic, very handy if x things reach a large number.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/448886/number-of-combinations-python</guid>
		</item>
				<item>
			<title>ComboBox Woes</title>
			<link>http://www.daniweb.com/software-development/vbnet/code/448862/combobox-woes</link>
			<pubDate>Wed, 27 Feb 2013 14:59:25 +0000</pubDate>
			<description>Upon resizing an anchored combobox - I noticed the text was always selected. This sparked the initiative to fix this problem. (Microsoft decided not to) So by extending the combobox class we can fix this. The following class can be dropped into a form for designer manipulation or as a ...</description>
			<content:encoded><![CDATA[ <p>Upon resizing an anchored combobox - I noticed the text was always selected.<br />
This sparked the initiative to fix this problem. (Microsoft decided not to)</p>

<p>So by extending the combobox class we can fix this.</p>

<p>The following class can be dropped into a form for designer manipulation or as a user control.</p>

<p>This is an extremely simple fix.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/vbnet/58">VB.NET</category>
			<dc:creator>Begginnerdev</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/vbnet/code/448862/combobox-woes</guid>
		</item>
				<item>
			<title>Control visual 3D object with Tkinter buttons</title>
			<link>http://www.daniweb.com/software-development/python/code/448444/control-visual-3d-object-with-tkinter-buttons</link>
			<pubDate>Fri, 22 Feb 2013 16:08:19 +0000</pubDate>
			<description>This Python snippet shows how to control a VPython visual 3D sphere with Tkinter GUI toolkit button clicks.</description>
			<content:encoded><![CDATA[ <p>This Python snippet shows how to control a VPython visual 3D sphere with Tkinter GUI toolkit button clicks.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>vegaseat</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/448444/control-visual-3d-object-with-tkinter-buttons</guid>
		</item>
				<item>
			<title>Multithreaded simple client/server chat console program</title>
			<link>http://www.daniweb.com/software-development/java/code/448361/multithreaded-simple-clientserver-chat-console-program</link>
			<pubDate>Thu, 21 Feb 2013 16:58:40 +0000</pubDate>
			<description>Hi everyone this is my first code snippet so be gentle.. I have written a basic client/server chat program that uses multithreading for listening and sending. I welcome any improvements or discussion... Thanks James</description>
			<content:encoded><![CDATA[ <p>Hi everyone this is my first code snippet so be gentle..</p>

<p>I have written a basic client/server chat program that uses multithreading for listening and sending.</p>

<p>I welcome any improvements or discussion...</p>

<p>Thanks<br />
James</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/java/9">Java</category>
			<dc:creator>james6754</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/java/code/448361/multithreaded-simple-clientserver-chat-console-program</guid>
		</item>
				<item>
			<title>Function from method: increment and decrement without function definition</title>
			<link>http://www.daniweb.com/software-development/python/code/448289/function-from-method-increment-and-decrement-without-function-definition</link>
			<pubDate>Wed, 20 Feb 2013 21:35:05 +0000</pubDate>
			<description>You can fix one parameter of function call by calling underlying method of fixed parameter instead of using functools.partial or lambda statement.</description>
			<content:encoded><![CDATA[ <p>You can fix one parameter of function call by calling underlying method of fixed parameter instead of using functools.partial or lambda statement.</p>
 ]]></content:encoded>
			<category domain="http://www.daniweb.com/software-development/python/114">Python</category>
			<dc:creator>pyTony</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/software-development/python/code/448289/function-from-method-increment-and-decrement-without-function-definition</guid>
		</item>
			</channel>
</rss>