<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Silveira Neto &#187; cat</title>
	<atom:link href="http://silveiraneto.net/tag/cat/feed/" rel="self" type="application/rss+xml" />
	<link>http://silveiraneto.net</link>
	<description></description>
	<lastBuildDate>Fri, 09 Mar 2012 04:13:27 +0000</lastBuildDate>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Pixel Boris</title>
		<link>http://silveiraneto.net/2009/04/20/pixel-boris/</link>
		<comments>http://silveiraneto.net/2009/04/20/pixel-boris/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 06:04:10 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[boris]]></category>
		<category><![CDATA[Boris Wilson]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[gato]]></category>
		<category><![CDATA[pixeart]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=2507</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2009/04/20/pixel-boris/" title="Pixel Boris"></a>Not a tile, a char neither a monster. The old friend of mine Boris, now in pixels.]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2009/04/20/pixel-boris/" title="Pixel Boris"></a><p style="text-align: center;"><img class="size-full wp-image-2506 aligncenter" title="I miss him" src="http://silveiraneto.net/wp-content/uploads/2009/04/boris_wilson_pixelart.png" alt="boris wilson pixelart" width="216" height="141" /></p>
<p>Not a tile, a char neither a monster. The <a href="/tag/boris">old friend of mine Boris</a>, now in pixels.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2009/04/20/pixel-boris/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Example of Unix commands implemented in Java</title>
		<link>http://silveiraneto.net/2008/10/07/example-of-unix-commands-implemented-in-java/</link>
		<comments>http://silveiraneto.net/2008/10/07/example-of-unix-commands-implemented-in-java/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 23:42:31 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[cd]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[ls]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[pwd]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1364</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/10/07/example-of-unix-commands-implemented-in-java/" title="Example of Unix commands implemented in Java"></a>I created some illustrative and simple implementations of common Unix commands. For those who are familiar with Unix-like systems them make easier to understand Java. For those who are familiar with Java them make easier to understand Unix-like systems. :-) &#8230;<p class="read-more"><a href="http://silveiraneto.net/2008/10/07/example-of-unix-commands-implemented-in-java/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/10/07/example-of-unix-commands-implemented-in-java/" title="Example of Unix commands implemented in Java"></a><p>I created some illustrative and simple implementations of common Unix commands. For those who are familiar with Unix-like systems them make easier to understand Java. For those who are familiar with Java them make easier to understand Unix-like systems. :-)</p>
<p><strong>1. PWD</strong></p>
<p><strong></strong></p>
<p>The first one is <a title="Wikipedia, english" href="http://en.wikipedia.org/wiki/Pwd">pwd</a> that show the current working directory.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Jpwd <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">String</span> pwd <span style="color: #339933;">=</span> <span style="color: #003399;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;user.dir&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>pwd<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Running this at /home/silveira directory gives us as output:</p>
<blockquote><p>$ java Jpwd</p>
<p>/home/silveira</p></blockquote>
<p><strong>1. CAT</strong></p>
<p>The command <a title="Wikipedia, english" href="http://en.wikipedia.org/wiki/Cat_(Unix)">cat</a> is usually utilized for displaying files.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileNotFoundException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Jcat <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>args.<span style="color: #006633;">length</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">FileReader</span> fileReader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileReader</span><span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #003399;">BufferedReader</span> in <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span>fileReader<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #003399;">String</span> line<span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> in.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">FileNotFoundException</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;, file not found.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;, input/output error.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<blockquote><p>$ java Jcat /etc/timezone</p>
<p>America/Fortaleza</p></blockquote>
<p><strong>3. LS</strong></p>
<p><strong></strong></p>
<p>The command ls is to list files. The File API (<a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html">java.io.File</a>) is very flexible and portable, but in this example I want just list files and directories of the current directory.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Jls <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">File</span> dir <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;user.dir&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">String</span> childs<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> dir.<span style="color: #006633;">list</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> child<span style="color: #339933;">:</span> childs<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>child<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Usage:</p>
<blockquote><p>$ java Jpwd</p>
<p>/home/silveira/example</p>
<p>$ java Jls</p>
<p>directoryA</p>
<p>fileA</p>
<p>.somefile</p></blockquote>
<p><del datetime="2008-10-09T15:50:53+00:00"><strong>4. CD</strong></p>
<p>The <a href="http://en.wikipedia.org/wiki/Cd_(command)">cd</a> command changes the current working directory.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Jcd <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>args.<span style="color: #006633;">length</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">File</span> dir <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>dir.<span style="color: #006633;">isDirectory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">System</span>.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;user.dir&quot;</span>, dir.<span style="color: #006633;">getAbsolutePath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;is not a directory.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Usage:</p>
<blockquote><p>$ java Jpwd<br />
/home/silveira<br />
$ java Jcd /tmp<br />
$ java Jpwd<br />
/tmp</p></blockquote>
<p></del></p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/10/07/example-of-unix-commands-implemented-in-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Boris Wilson</title>
		<link>http://silveiraneto.net/2008/05/26/boris-wilson-2/</link>
		<comments>http://silveiraneto.net/2008/05/26/boris-wilson-2/#comments</comments>
		<pubDate>Mon, 26 May 2008 21:55:32 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[português]]></category>
		<category><![CDATA[boris]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[kitten]]></category>
		<category><![CDATA[siamês]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=936</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/05/26/boris-wilson-2/" title="Boris Wilson"></a>Boris Wilson, originalmente por Silveira Neto. Boris, refletindo sobre a vida&#8230;]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/05/26/boris-wilson-2/" title="Boris Wilson"></a><div style="text-align: left; padding: 3px;"><a title="photo sharing" href="http://www.flickr.com/photos/silveiraneto/2515358348/"><img style="border: solid 2px #000000;" src="http://farm3.static.flickr.com/2305/2515358348_d01a55561a.jpg" alt="" /></a><span style="font-size: 0.8em; margin-top: 0px;"><br />
<a href="http://www.flickr.com/photos/silveiraneto/2515358348/">Boris Wilson</a>, originalmente por <a href="http://www.flickr.com/people/silveiraneto/">Silveira Neto</a>.</span></div>
<p>Boris, refletindo sobre a vida&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/05/26/boris-wilson-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Boris Wilson</title>
		<link>http://silveiraneto.net/2008/05/22/boris-wilson/</link>
		<comments>http://silveiraneto.net/2008/05/22/boris-wilson/#comments</comments>
		<pubDate>Fri, 23 May 2008 02:39:43 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[boris]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[kitten]]></category>
		<category><![CDATA[siamês]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/05/22/boris-wilson/</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/05/22/boris-wilson/" title="Boris Wilson"></a>Boris Wilson, originally uploaded by Silveira Neto. Boris, thinking about life&#8230;]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/05/22/boris-wilson/" title="Boris Wilson"></a><div style="text-align: left; padding: 3px;"><a title="photo sharing" href="http://www.flickr.com/photos/silveiraneto/2515358348/"><img style="border: solid 2px #000000;" src="http://farm3.static.flickr.com/2305/2515358348_d01a55561a.jpg" alt="" /></a></p>
<p><span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/silveiraneto/2515358348/">Boris Wilson</a>, originally uploaded by <a href="http://www.flickr.com/people/silveiraneto/">Silveira Neto</a>.</span></p>
</div>
<p>Boris, thinking about life&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/05/22/boris-wilson/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Boris in a box</title>
		<link>http://silveiraneto.net/2008/03/30/boris-in-a-box/</link>
		<comments>http://silveiraneto.net/2008/03/30/boris-in-a-box/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 15:08:00 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[boris]]></category>
		<category><![CDATA[Boris Wilson]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[pet]]></category>
		<category><![CDATA[siamese]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=815</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/03/30/boris-in-a-box/" title="Boris in a box"></a>Boris Wilson, my girlfriend&#8217;s pet, a siamese cat. He loves play in a new box.]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/03/30/boris-in-a-box/" title="Boris in a box"></a><p style="text-align: center;"><img class="aligncenter" src="http://farm4.static.flickr.com/3089/2374137012_f6f14d9c81_o.jpg" alt="Boris Wilson in a box" /></p>
<p>Boris Wilson, my girlfriend&#8217;s pet, a siamese cat. He loves play in a new box.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/03/30/boris-in-a-box/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Gato em JavaFX, versão 2</title>
		<link>http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/</link>
		<comments>http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 22:13:10 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[animação]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[gato]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfxbest]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[vídeo]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/" title="Gato em JavaFX, versão 2"></a>Lembra daquele nosso gato em Java FX? Agora ele move os olhos com cliques em botões. Código fonte: import javafx.ui.canvas.*; import javafx.ui.*; &#160; class Cat extends CompositeNode&#123; attribute look: Number; // -1.0 to 1.0 operation lookLeft&#40;&#41;; operation lookCenter&#40;&#41;; operation lookRight&#40;&#41;; &#8230;<p class="read-more"><a href="http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/" title="Gato em JavaFX, versão 2"></a><p>Lembra <a href="http://silveiraneto.net/2008/01/30/gato-em-javafx/">daquele nosso gato</a> em Java FX? Agora ele move os olhos com cliques em botões.<br />
<center><br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/7FQzTkZK-gI&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/7FQzTkZK-gI&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object><br />
</center></p>
<p><strong>Código fonte:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.canvas.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Cat <span style="color: #000000; font-weight: bold;">extends</span> CompositeNode<span style="color: #009900;">&#123;</span>
    attribute look<span style="color: #339933;">:</span> <span style="color: #003399;">Number</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// -1.0 to 1.0</span>
    operation lookLeft<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    operation lookCenter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    operation lookRight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
attribute Cat.<span style="color: #006633;">look</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 0 = middle</span>
&nbsp;
operation Cat.<span style="color: #006633;">lookLeft</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    look <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>look, look <span style="color: #339933;">-</span> <span style="color: #cc66cc;">0.1</span> .. <span style="color: #339933;">-</span><span style="color: #cc66cc;">1.0</span><span style="color: #009900;">&#93;</span> dur <span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
operation Cat.<span style="color: #006633;">lookCenter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    var step <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">if</span> look <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span> then <span style="color: #cc66cc;">0.1</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">0.1</span><span style="color: #339933;">;</span>
    look <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>look, look<span style="color: #339933;">+</span>step .. <span style="color: #cc66cc;">0.0</span><span style="color: #009900;">&#93;</span> dur <span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
operation Cat.<span style="color: #006633;">lookRight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    look <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>look, look <span style="color: #339933;">+</span> <span style="color: #cc66cc;">0.1</span> .. <span style="color: #cc66cc;">1.0</span><span style="color: #009900;">&#93;</span> dur <span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
function Cat.<span style="color: #006633;">composeNode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    var head <span style="color: #339933;">=</span>  Ellipse <span style="color: #009900;">&#123;</span>cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">50</span>, fill<span style="color: #339933;">:</span>black <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    var rightEar <span style="color: #339933;">=</span>  Arc <span style="color: #009900;">&#123;</span>x<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">10</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">150</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
                       startAngle<span style="color: #339933;">:-</span><span style="color: #cc66cc;">20</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    var leftEar <span style="color: #339933;">=</span> Arc <span style="color: #009900;">&#123;</span>x<span style="color: #339933;">:</span>000, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">10</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">150</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
                     startAngle<span style="color: #339933;">:</span><span style="color: #cc66cc;">110</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    var leftEye <span style="color: #339933;">=</span> Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">60</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    var rightEye <span style="color: #339933;">=</span> Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">140</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    var nose <span style="color: #339933;">=</span> Arc <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span><span style="color: #cc66cc;">85</span>, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">110</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">20</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>,
                     startAngle<span style="color: #339933;">:</span><span style="color: #cc66cc;">45</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    var rightIris <span style="color: #339933;">=</span> Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span> bind <span style="color: #cc66cc;">140</span><span style="color: #339933;">+</span>look<span style="color: #339933;">*</span><span style="color: #cc66cc;">20</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
                     radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    var leftIris <span style="color: #339933;">=</span> Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span> bind <span style="color: #cc66cc;">60</span><span style="color: #339933;">+</span>look<span style="color: #339933;">*</span><span style="color: #cc66cc;">20</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
                     radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>    
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">Group</span><span style="color: #009900;">&#123;</span>content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>head, rightEar, leftEar, leftEye,
                     leftIris, rightEye, rightIris, nose<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
var myCat <span style="color: #339933;">=</span> Cat<span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
var myCatControl <span style="color: #339933;">=</span> <span style="color: #003399;">View</span> <span style="color: #009900;">&#123;</span>
            transform<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>translate<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">150</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span>
            content<span style="color: #339933;">:</span> GroupPanel <span style="color: #009900;">&#123;</span>
                cursor<span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">DEFAULT</span>
                var row <span style="color: #339933;">=</span> Row <span style="color: #009900;">&#123;</span>alignment<span style="color: #339933;">:</span> BASELINE<span style="color: #009900;">&#125;</span>
                var column1 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                var column2 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                var column3 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                var column4 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                var column5 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                rows<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>row<span style="color: #009900;">&#93;</span>
                columns<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>column1, column2, column3, column4<span style="color: #009900;">&#93;</span>
                content<span style="color: #339933;">:</span>
                <span style="color: #009900;">&#91;</span>SimpleLabel <span style="color: #009900;">&#123;</span>
                    row<span style="color: #339933;">:</span> row
                    column<span style="color: #339933;">:</span> column1
                    text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Look:&quot;</span>
                <span style="color: #009900;">&#125;</span>,
                <span style="color: #003399;">Button</span> <span style="color: #009900;">&#123;</span>
                    row<span style="color: #339933;">:</span> row
                    column<span style="color: #339933;">:</span> column2
                    mnemonic<span style="color: #339933;">:</span> L
                    text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Left&quot;</span>
                    action<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        myCat.<span style="color: #006633;">lookLeft</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>,
                <span style="color: #003399;">Button</span> <span style="color: #009900;">&#123;</span>
                    row<span style="color: #339933;">:</span> row
                    column<span style="color: #339933;">:</span> column3
                    mnemonic<span style="color: #339933;">:</span> C
                    text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Center&quot;</span>
                    action<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        myCat.<span style="color: #006633;">lookCenter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>,
                <span style="color: #003399;">Button</span> <span style="color: #009900;">&#123;</span>
                    row<span style="color: #339933;">:</span> row
                    column<span style="color: #339933;">:</span> column4
                    mnemonic<span style="color: #339933;">:</span> R
                    text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Right&quot;</span>
                    action<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        myCat.<span style="color: #006633;">lookRight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003399;">Canvas</span> <span style="color: #009900;">&#123;</span>
    content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>myCatControl, myCat<span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Downloads:</p>
<ul>
<li>Código-fonte: <a href="http://silveiraneto.net/downloads/cat_ver2.fx">cat_ver2.fx</a></li>
<li>Vídeo: <a href="http://silveiraneto.net/downloads/moving_eyes_cat.ogg">moving_eyes_cat.ogg</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

