<?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; RIA</title>
	<atom:link href="http://silveiraneto.net/tag/ria/feed/" rel="self" type="application/rss+xml" />
	<link>http://silveiraneto.net</link>
	<description>the world is a pixel</description>
	<lastBuildDate>Sun, 08 Jan 2012 05:17:57 +0000</lastBuildDate>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>FootprintFX</title>
		<link>http://silveiraneto.net/2009/06/02/footprintfx/</link>
		<comments>http://silveiraneto.net/2009/06/02/footprintfx/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 04:53:28 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[Felipe Gaúcho]]></category>
		<category><![CDATA[Footprint]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=2646</guid>
		<description><![CDATA[Footprint is a publisher and distributor of certificates of participation in conferences &#8211; signed PDF documents that prove you attended a conference or a course. This is a little JavaFX application that shows how to create a interface that displays data provided by services. This version uses three services: one that counts the number of [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-2647 aligncenter" title="Footprint logo" src="http://silveiraneto.net/wp-content/uploads/2009/06/footprintlogo.jpg" alt="Footprint logo" width="109" height="80" /></p>
<p><a title="Footprint" href="https://footprint.dev.java.net/">Footprint</a> is a publisher and distributor of certificates of participation in conferences &#8211; signed PDF documents that prove you attended a conference or a course.</p>
<p>This is a little JavaFX application that shows how to create a interface that displays data provided by services. This version uses three services: one that counts the number of users, other that counts the number of events and one that list these events. Check out the <a title="JAVAFX Source Code " href="http://silveiraneto.net/downloads/javafx/footprintfx/src/footprintfx/Main.fx">source code here</a>.  Try the application as a draggable <a title="JavaFX" href="http://silveiraneto.net/downloads/javafx/footprintfx/dist/footprintfx.html">JavaFX applet here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2009/06/02/footprintfx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaFX 1.1 for Linux workaround</title>
		<link>http://silveiraneto.net/2009/05/16/javafx-11-for-linux-workaround/</link>
		<comments>http://silveiraneto.net/2009/05/16/javafx-11-for-linux-workaround/#comments</comments>
		<pubDate>Sat, 16 May 2009 11:53:15 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[HuaSong Liu]]></category>
		<category><![CDATA[jaunty jackalope]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[javafx4linux]]></category>
		<category><![CDATA[jfx]]></category>
		<category><![CDATA[Kaesar Alnijres]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Weiqi Gao]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=2581</guid>
		<description><![CDATA[Download javafx4linux.tar.bz2 (~ 36Mb). Installing 1) Extract the javafx4linux.tar.bz2 file. In this example I&#8217;m placing it on my Desktop. After the installing process you can remove it. 2) Open your NetBeans 6.5 and go at Tools → Plugins and go to Downloaded tab. In a plain and new NetBeans installation there will be no plugin [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Download</strong></p>
<blockquote><p><a title="JavaFX for Linux" href="http://silveiraneto.net/downloads/javafx4linux.tar.bz2">javafx4linux.tar.bz2</a> (~ 36Mb).</p></blockquote>
<p><strong>Installing</strong></p>
<p>1) Extract the javafx4linux.tar.bz2 file. In this example I&#8217;m placing it on my Desktop. After the installing process you can remove it.</p>
<p style="text-align: center;"><strong><a href="http://silveiraneto.net/wp-content/uploads/2009/05/javafx_linux_ubuntu_extract.png"><img class="size-medium wp-image-2593 aligncenter" title="javafx linux ubuntu extract" src="http://silveiraneto.net/wp-content/uploads/2009/05/javafx_linux_ubuntu_extract-500x312.png" alt="javafx linux ubuntu extract" width="500" height="312" /></a><br />
</strong></p>
<p>2) Open your NetBeans 6.5 and go at <em>Tools</em> → <em>Plugins</em> and go to <em>Downloaded</em> tab. In a plain and new NetBeans installation there will be no plugin in this tab yet.</p>
<p style="text-align: center;"><strong><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step01.png"><img class="alignnone size-medium wp-image-2582" title="netbeans javafx linux step01" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step01-500x312.png" alt="netbeans javafx linux step01" width="500" height="312" /></a><br />
</strong></p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step02.png"><img class="size-medium wp-image-2583 aligncenter" title="netbeans javafx linux step02" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step02-500x312.png" alt="netbeans javafx linux step02" width="500" height="312" /></a></p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step03.png"><img class="size-medium wp-image-2584 aligncenter" title="netbeans javafx linux step03" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step03-500x312.png" alt="netbeans javafx linux step03" width="500" height="312" /></a></p>
<p>3) Click on the <em>Add Plugins</em> button and head to the directory you extracted the file and select all .nbm files.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step04.png"><img class="size-medium wp-image-2585 aligncenter" title="netbeans javafx linux step 04" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step04-500x312.png" alt="netbeans javafx linux step 04" width="500" height="312" /></a></p>
<p>4) You will see a list of 22 plugins selected. Click on the <em>Install</em> button.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step05.png"><img class="size-medium wp-image-2586 aligncenter" title="netbeans javafx linux step 05" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step05-500x312.png" alt="netbeans javafx linux step 05" width="500" height="312" /></a></p>
<p>5) Just keep clicking on the <em>Next</em> button.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step06.png"><img class="size-medium wp-image-2587 aligncenter" title="netbeans javafx linux step 6" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step06-500x312.png" alt="netbeans javafx linux step 6" width="500" height="312" /></a></p>
<p>6) Check the license agreement accept box.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step07.png"><img class="size-medium wp-image-2588 aligncenter" title="netbeans javafx linux step 7" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step07-500x312.png" alt="netbeans javafx linux step 7" width="500" height="312" /></a></p>
<p>7) You&#8217;ll see a warning because the Linux pluggin is not signed. Don&#8217;t worry, just click <em>Continue</em>.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step08.png"><img class="size-medium wp-image-2589 aligncenter" title="netbeans javafx linux step 8" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step08-500x312.png" alt="netbeans javafx linux step 8" width="500" height="312" /></a></p>
<p>8) Click on Finish to restart NetBeans.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step09.png"><img class="size-medium wp-image-2590 aligncenter" title="netbeans javafx linux step 9" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step09-500x312.png" alt="netbeans javafx linux step 9" width="500" height="312" /></a></p>
<p>9) Now we can test it. Go at <em>File</em> → <em>New Project</em>, select the JavaFX on <em>Categories</em> and <em>JavaFX Script Application</em> on Projects.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step10.png"><img class="alignnone size-medium wp-image-2591" title="netbeans javafx linux step 10" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step10-500x312.png" alt="netbeans javafx linux step 10" width="500" height="312" /></a></p>
<p>10) Put some code and run it. There is. JavaFX on Linux.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step11.png"><img class="size-medium wp-image-2592 aligncenter" title="netbeans javafx linux step 11" src="http://silveiraneto.net/wp-content/uploads/2009/05/netbeans_javafx_linux_step11-500x312.png" alt="netbeans javafx linux step 11" width="500" height="312" /></a></p>
<p><strong>Considerations</strong></p>
<p>This is not a official of JavaFX for Linux! This solution was tested on Ubuntu 9.04 &#8220;Jaunty Jackalope&#8221; with Java 6 update 13 and NetBeans 6.5.1, but should also work with others Linux distributions and Java versions greater than 5.</p>
<p><strong>Known bugs</strong></p>
<p>As a non official workaround for JavaFX for Linux you may notice some drawbacks. Some parts of the JavaFX runtime rely on native implementations on the specific operational system. You may not use some multimedia capabilities as video playback, JavaFX Mobile emulator and some performance issues in some effects. Despite that, is perfectly possible to develop applications using JavaFX on NetBeans.</p>
<p><strong>Thanks</strong></p>
<p>I&#8217;d like to thanks some guys around the world. <a href="http://www.weiqigao.com/blog/2008/12/04/using_javafx_1_0_on_linux.html">Weiqi Gao&#8217;s original post on JavaFX on Linux</a>, <a href="http://java.dzone.com/tips/javafx-11-linux-netbeans">HuaSong Liu article on DZone</a> and <a href="http://java-javafx-iipt.blogspot.com/2009/03/javafx-111-netbeans-651-on-linux.html">Kaesar Alnijres post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2009/05/16/javafx-11-for-linux-workaround/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>JavaFX, easy use of tiles</title>
		<link>http://silveiraneto.net/2009/01/06/javafx-easy-use-of-tiles/</link>
		<comments>http://silveiraneto.net/2009/01/06/javafx-easy-use-of-tiles/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 14:07:38 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[Pixelart]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[tileset]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=2098</guid>
		<description><![CDATA[Continuing my little JavaFX framework for game development, right now focused on use those tiles I&#8217;m drawing and posting here in my blog. This framework will be a group of classes for simplify and hide some complexities of common game development. Right now I wrote just a few of them. Use We create a tileset [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing my little JavaFX framework for game development, right now focused on use those tiles I&#8217;m drawing and posting here in my blog. This framework will be a group of classes for simplify and hide some complexities of common game development. Right now I wrote just a few of them.</p>
<p><strong>Use</strong></p>
<p>We create a tileset from the files.png file that way</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;">var tileset <span style="color: #339933;">=</span> Tileset <span style="color: #009900;">&#123;</span>
    cols<span style="color: #339933;">:</span> <span style="color: #cc66cc;">15</span> rows<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span> height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">32</span> width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">32</span>
    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}tiles.png&quot;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p style="text-align: center;"><img class="size-full wp-image-2110 aligncenter" title="tiles" src="http://silveiraneto.net/wp-content/uploads/2009/01/tiles.png" alt="tiles" width="285" height="237" /></p>
<p>Tileset are orthogonal, distributed into a grid of <em>cols</em> columns and <em>rows</em> rows. Each tile have dimensions <em>height</em> x <em>width</em>.</p>
<p>A Tileset is used into a Tilemap</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;">var bg <span style="color: #339933;">=</span> Tilemap <span style="color: #009900;">&#123;</span>
    set<span style="color: #339933;">:</span>tileset cols<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span> rows<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span>
    map<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>That shows</p>
<p style="text-align: center;"><img class="size-full wp-image-2100 aligncenter" title="bg tilemap" src="http://silveiraneto.net/wp-content/uploads/2009/01/bg_tilemap.png" alt="bg tilemap" width="160" height="160" /></p>
<p>Each number in the map represents a tile in the tilemap. Number 0 means the first tile at the upper left corner, numbers keep growing from left to right columns, from top to bottom rows.</p>
<p>Another example</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;">var things <span style="color: #339933;">=</span> Tilemap <span style="color: #009900;">&#123;</span>
    set<span style="color: #339933;">:</span>tileset cols<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span> rows<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span>
    map<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">80</span>,<span style="color: #cc66cc;">55</span>,<span style="color: #cc66cc;">56</span>,<span style="color: #cc66cc;">145</span>,<span style="color: #cc66cc;">145</span>,<span style="color: #cc66cc;">96</span>,<span style="color: #cc66cc;">71</span>,<span style="color: #cc66cc;">72</span>,<span style="color: #cc66cc;">61</span>,<span style="color: #cc66cc;">62</span>,0,0,0,<span style="color: #cc66cc;">77</span>,<span style="color: #cc66cc;">78</span>,<span style="color: #cc66cc;">122</span>,0,0,<span style="color: #cc66cc;">93</span>,<span style="color: #cc66cc;">94</span>,<span style="color: #cc66cc;">138</span>,0,0,0,0<span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p style="text-align: center;"><img class="size-full wp-image-2101 aligncenter" title="things tileset" src="http://silveiraneto.net/wp-content/uploads/2009/01/things_tileset.png" alt="things tileset" width="160" height="160" /></p>
<p>A tilemap can also contains more than one layer</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;">var room <span style="color: #339933;">=</span> Tilemap <span style="color: #009900;">&#123;</span>
    set<span style="color: #339933;">:</span>tileset cols<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span> rows<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span> layers<span style="color: #339933;">:</span><span style="color: #cc66cc;">2</span>
    map<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span>,
        <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">80</span>,<span style="color: #cc66cc;">55</span>,<span style="color: #cc66cc;">56</span>,<span style="color: #cc66cc;">145</span>,<span style="color: #cc66cc;">145</span>,<span style="color: #cc66cc;">96</span>,<span style="color: #cc66cc;">71</span>,<span style="color: #cc66cc;">72</span>,<span style="color: #cc66cc;">61</span>,<span style="color: #cc66cc;">62</span>,0,0,0,<span style="color: #cc66cc;">77</span>,<span style="color: #cc66cc;">78</span>,<span style="color: #cc66cc;">122</span>,0,0,<span style="color: #cc66cc;">93</span>,<span style="color: #cc66cc;">94</span>,<span style="color: #cc66cc;">138</span>,0,0,0,0<span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p style="text-align: center;"><img class="size-full wp-image-2102 aligncenter" title="tileroom" src="http://silveiraneto.net/wp-content/uploads/2009/01/tileroom.png" alt="tileroom" width="160" height="160" /></p>
<p><strong>Implementation</strong></p>
<p>The Tileset class basically stores a Image and a collection of Rectangle2D objects, for be used as viewports in <a href="http://java.sun.com/javafx/1/docs/api/javafx.scene.image/javafx.scene.image.ImageView.html">ImageView</a> classes.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.ImageView</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.Image</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.geometry.Rectangle2D</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Tileset <span style="color: #009900;">&#123;</span>
    public<span style="color: #339933;">-</span>init var      image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span>;
    public<span style="color: #339933;">-</span>init var      width<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">32</span>;
    public<span style="color: #339933;">-</span>init var     height<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">32</span>;
    public<span style="color: #339933;">-</span>init var       rows<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span>;
    public<span style="color: #339933;">-</span>init var       cols<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span>;
    <span style="color: #000000; font-weight: bold;">protected</span>   var       tile<span style="color: #339933;">:</span> <span style="color: #003399;">Rectangle2D</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>;
&nbsp;
    init <span style="color: #009900;">&#123;</span>
        tile <span style="color: #339933;">=</span>  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>row in <span style="color: #009900;">&#91;</span>0..<span style="color: #006633;">rows</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>col in <span style="color: #009900;">&#91;</span>0..<span style="color: #006633;">cols</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">Rectangle2D</span><span style="color: #009900;">&#123;</span>
                    minX<span style="color: #339933;">:</span> col <span style="color: #339933;">*</span> width, minY<span style="color: #339933;">:</span> row <span style="color: #339933;">*</span> height
                    height<span style="color: #339933;">:</span> width, width<span style="color: #339933;">:</span> height
                <span style="color: #009900;">&#125;</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>The Tilemap is a <a href="http://java.sun.com/javafx/1/docs/api/javafx.scene/javafx.scene.CustomNode.html">CustomNode</a> with a Group of ImageViews in a grid. The grid is mounted by iterating over the map as many layers was defined.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Tilemap <span style="color: #000000; font-weight: bold;">extends</span> CustomNode <span style="color: #009900;">&#123;</span>
    public<span style="color: #339933;">-</span>init var   rows<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span>;
    public<span style="color: #339933;">-</span>init var   cols<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span>;
    public<span style="color: #339933;">-</span>init var    set<span style="color: #339933;">:</span> Tileset;
    public<span style="color: #339933;">-</span>init var layers<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>;
    public<span style="color: #339933;">-</span>init var    map<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> override function create<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> Node <span style="color: #009900;">&#123;</span>
        var tilesperlayer <span style="color: #339933;">=</span> rows <span style="color: #339933;">*</span> cols;
        <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: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>layer in <span style="color: #009900;">&#91;</span>0..<span style="color: #006633;">layers</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>row in <span style="color: #009900;">&#91;</span>0..<span style="color: #006633;">rows</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>col in <span style="color: #009900;">&#91;</span>0..<span style="color: #006633;">cols</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            ImageView <span style="color: #009900;">&#123;</span>
                                image<span style="color: #339933;">:</span> set.<span style="color: #006633;">image</span> x<span style="color: #339933;">:</span> col <span style="color: #339933;">*</span> set.<span style="color: #006633;">width</span> y<span style="color: #339933;">:</span> row <span style="color: #339933;">*</span> set.<span style="color: #006633;">height</span>
                                viewport<span style="color: #339933;">:</span> set.<span style="color: #006633;">tile</span><span style="color: #009900;">&#91;</span>map<span style="color: #009900;">&#91;</span>tilesperlayer<span style="color: #339933;">*</span>layer <span style="color: #339933;">+</span> row<span style="color: #339933;">*</span>rows<span style="color: #339933;">+</span>col<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</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>
        <span style="color: #009900;">&#125;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><strong>Next steps</strong></p>
<ul>
<li>Integrate to a map editor</li>
<li>Support some XML map format</li>
<li>Sprite classes for animation</li>
<li>Integrate those collision detection classes I posted before</li>
</ul>
<p><strong>Download</strong></p>
<ul>
<li>Source code and NetBeans project, <a title="download" href="http://silveiraneto.net/downloads/tileworld.tar.bz2">tileworld.tar.bz2</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2009/01/06/javafx-easy-use-of-tiles/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Reading Twitter with JavaFX</title>
		<link>http://silveiraneto.net/2009/01/04/reding-twitter-with-javafx/</link>
		<comments>http://silveiraneto.net/2009/01/04/reding-twitter-with-javafx/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 22:56:55 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfx]]></category>
		<category><![CDATA[microblogging]]></category>
		<category><![CDATA[openjfx]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=2064</guid>
		<description><![CDATA[Twitter is a social network and micro-blogging service that allow you to create and read tweets, 140 characters text-based posts. It&#8217;s becoming a popular tool to keep in touch with your friends, coworkers, bloggers, etc. Here we&#8217;ll create a very simple application that show us tweets related with a given word. Twitter offers a very [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-2073 aligncenter" title="twitter bird" src="http://silveiraneto.net/wp-content/uploads/2009/01/twitter-bird.gif" alt="twitter bird" width="250" height="184" /></p>
<p><a title="Twitter Micro Blogging Service" href="http://twitter.com">Twitter</a> is a social network and micro-blogging service that allow you to create and read tweets, 140 characters text-based posts. It&#8217;s becoming a popular tool to keep in touch with your friends, coworkers, bloggers, etc. Here we&#8217;ll create a very simple application that show us tweets related with a given word.</p>
<p>Twitter offers a very simple and powerfull <a href="http://apiwiki.twitter.com/">REST API</a> which supports <a rel="nofollow" href="http://en.wikipedia.org/wiki/XML"><span>XML</span></a>, <a rel="nofollow" href="http://en.wikipedia.org/wiki/Json"><span>JSON</span></a>, and the <a rel="nofollow" href="http://en.wikipedia.org/wiki/RSS"><span>RSS</span></a> and <a rel="nofollow" href="http://en.wikipedia.org/wiki/Atom_%28standard%29">Atom</a> formats. As we are aiming just to read tweets we&#8217;ll use just the Search API.</p>
<p>We do that in three steps:</p>
<ol>
<li>Query Tweets</li>
<li>Parser the Atom result</li>
<li>Show tweets into a GUI</li>
</ol>
<p>Let&#8217;s see them in the order of dependence beetween them.</p>
<p><strong>Displaying a Tweet</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;">var gradient <span style="color: #339933;">=</span> LinearGradient <span style="color: #009900;">&#123;</span>
    startX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">0.0</span>,
    startY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">0.0</span>,
    endX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">0.0</span>,
    endY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">150.0</span>
    proportional<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">false</span>
    stops<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>Stop <span style="color: #009900;">&#123;</span>offset<span style="color: #339933;">:</span> <span style="color: #cc66cc;">0.0</span> color<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">DARKGRAY</span> <span style="color: #009900;">&#125;</span>,
        Stop <span style="color: #009900;">&#123;</span> offset<span style="color: #339933;">:</span> <span style="color: #cc66cc;">1.0</span> color<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Tweet <span style="color: #000000; font-weight: bold;">extends</span> CustomNode <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> var image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span>;
    <span style="color: #000000; font-weight: bold;">public</span> var username<span style="color: #339933;">:</span> <span style="color: #003399;">String</span>;
    <span style="color: #000000; font-weight: bold;">public</span> var message<span style="color: #339933;">:</span> <span style="color: #003399;">String</span>;
    <span style="color: #000000; font-weight: bold;">public</span> override function create<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> Node <span style="color: #009900;">&#123;</span>
        var txt <span style="color: #339933;">=</span> Text <span style="color: #009900;">&#123;</span>
            x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">65</span>  y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">35</span> wrappingWidth<span style="color: #339933;">:</span> <span style="color: #cc66cc;">150</span> fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">WHITE</span>
            content<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{message}&quot;</span>
        <span style="color: #009900;">&#125;</span>
        <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>
                <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span>
                    width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">220</span> height<span style="color: #339933;">:</span> txt.<span style="color: #006633;">boundsInLocal</span>.<span style="color: #006633;">height</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">40</span>
                    arcHeight<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span> arcWidth<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span> fill<span style="color: #339933;">:</span> gradient
                <span style="color: #009900;">&#125;</span>,
                ImageView <span style="color: #009900;">&#123;</span>
                    x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">5</span> y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">20</span> image<span style="color: #339933;">:</span> image
                <span style="color: #009900;">&#125;</span>,
                Text <span style="color: #009900;">&#123;</span>
                    x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">65</span>  y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">20</span> fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span> content<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{username} said&quot;</span>
                <span style="color: #009900;">&#125;</span>,
                txt
            <span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#125;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>For example, <a title="P4bl0's Tweet" href="http://twitter.com/p4bl0/statuses/1095717367">this tweet</a> would become:</p>
<p style="text-align: center;"><img class="size-full wp-image-2070 aligncenter" title="tweet example" src="http://silveiraneto.net/wp-content/uploads/2009/01/tweet_example.png" alt="tweet example" width="220" height="100" /></p>
<p><strong>Parsing ATOM result</strong></p>
<p>In <a title="XML Sandwich JavaFX " href="http://silveiraneto.net/2008/12/25/parsing-xml-sandwich-with-javafx/">my last post about JavaFX</a> I showed how to parse XML documents (and make sandwiches) with JavaFX. Here we&#8217;ll use the Atom format, but use any other would be almost the same. Parsing XML or JSON documents with JavaFX is both very simple using the <a title="JavaFX API" href="http://java.sun.com/javafx/1/docs/api/javafx.data.pull/javafx.data.pull.PullParser.html">javafx.data.pull.PullParser</a> class.</p>
<p>A query output is a Atom XML document with several information. We are interested only in the fields that holds the avatar image, the message and the user name.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;">var tweets <span style="color: #339933;">=</span> VBox <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
def parser <span style="color: #339933;">=</span> PullParser <span style="color: #009900;">&#123;</span>
    var avatar;
    var firstname;
    var text;
    documentType<span style="color: #339933;">:</span> PullParser.<span style="color: #006633;">XML</span>;
&nbsp;
    onEvent<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span> <span style="color: #003399;">Event</span><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>event.<span style="color: #006633;">type</span> <span style="color: #339933;">==</span> PullParser.<span style="color: #006633;">START_ELEMENT</span><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>event.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;link&quot;</span><span style="color: #009900;">&#41;</span><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>event.<span style="color: #006633;">getAttributeValue</span><span style="color: #009900;">&#40;</span>QName<span style="color: #009900;">&#123;</span>name<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;rel&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;image&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    avatar <span style="color: #339933;">=</span> event.<span style="color: #006633;">getAttributeValue</span><span style="color: #009900;">&#40;</span>QName<span style="color: #009900;">&#123;</span>name<span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;href&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">type</span> <span style="color: #339933;">==</span> PullParser.<span style="color: #006633;">END_ELEMENT</span><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>event.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    text <span style="color: #339933;">=</span> event.<span style="color: #006633;">text</span>;
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span>and<span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">level</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                var names<span style="color: #339933;">:</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> event.<span style="color: #006633;">text</span>.<span style="color: #006633;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #009900;">&#41;</span>;
                firstname <span style="color: #339933;">=</span> names<span style="color: #009900;">&#91;</span>0<span style="color: #009900;">&#93;</span>;
                insert Tweet <span style="color: #009900;">&#123;</span>
                        image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
                            url<span style="color: #339933;">:</span> avatar
                        <span style="color: #009900;">&#125;</span>
                        message<span style="color: #339933;">:</span> text
                        username<span style="color: #339933;">:</span> firstname
                    <span style="color: #009900;">&#125;</span> into tweets.<span style="color: #006633;">content</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><strong>Querying Tweets</strong></p>
<p>We can get Atom results through url queries like that:</p>
<ul>
<li>Tweets containing the word Beatles <a href="http://search.twitter.com/search.atom?q=Beatles">http://search.twitter.com/search.atom?q=Beatles</a></li>
<li>Tweets from the user Silveira <a href="http://search.twitter.com/search.atom?q=from%3ASilveira">http://search.twitter.com/search.atom?q=from%3ASilveira</a></li>
<li>Tweets to the user Silveira <a href="http://search.twitter.com/search.atom?q=to%3ASilveira">http://search.twitter.com/search.atom?q=to%3ASilveira</a></li>
<li>Tweets containing the hashtag #CEJUG <a href="http://search.twitter.com/search.atom?q=to%23CEJUG">http://search.twitter.com/search.atom?q=to%23CEJUG</a></li>
</ul>
<p>Notice that queries should be URL encoded. We will use a additional parameters <strong>&amp;rpp=4</strong> to receive<strong> </strong>only 4 results per page. To know more about search queries read the <a title="Twitter Search API" href="http://apiwiki.twitter.com/Search+API+Documentation">Search API Documentation</a>. We get these results as  <a title="Java API InputStream" href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStream.html">InputStreams</a> making asynchronous HTTP requests using the <a title="JavaFX API" href="http://java.sun.com/javafx/1/docs/api/javafx.io.http/javafx.io.http.HttpRequest.html">javafx.io.http.HttpRequest</a> class, which it&#8217;s perfect to invoke   RESTful Web Services.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;">word <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Beatles&quot;</span>;
var request <span style="color: #339933;">=</span> HttpRequest <span style="color: #009900;">&#123;</span>
    location<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;http://search.twitter.com/search.atom?q={word}&amp;amp;rpp=4&quot;</span>;
    onInput<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span>stream<span style="color: #339933;">:</span> java.<span style="color: #006633;">io</span>.<span style="color: #003399;">InputStream</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        parser.<span style="color: #006633;">input</span> <span style="color: #339933;">=</span> stream;
        parser.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
request.<span style="color: #006633;">enqueue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre>
</div>
</div>
<p><strong>Conclusion</strong></p>
<p>Here is the application running for the word &#8220;House&#8221;.</p>
<p style="text-align: center;"><img class="size-full wp-image-2074 aligncenter" title="twitter with javafx" src="http://silveiraneto.net/wp-content/uploads/2009/01/twitter_with_javafx.png" alt="twitter with javafx" width="220" height="458" /></p>
<p>Is not a complete Twitter client, as it&#8217;s not intended to be, but can show you how to handle a simple asynchronous call and handle Twitter documents. There&#8217;s already a few beta JavaFX Twitter clients like <a title="Tweetbox at Google Code" href="http://code.google.com/p/tweetbox/">Tweetbox</a> and <a title="TwitterFX at Project Kenai" href="http://projectkenai.com/projects/twitterfx">Twitterfx</a> and certanly others will appears.</p>
<p><strong>Download</strong></p>
<p>Sources and Netbeans project, <a href="http://silveiraneto.net/downloads/fxtwitter.tar.bz2">fxtwitter.tar.bz2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2009/01/04/reding-twitter-with-javafx/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Parsing a XML Sandwich with JavaFX</title>
		<link>http://silveiraneto.net/2008/12/25/parsing-xml-sandwich-with-javafx/</link>
		<comments>http://silveiraneto.net/2008/12/25/parsing-xml-sandwich-with-javafx/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 02:39:54 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfx]]></category>
		<category><![CDATA[openjfx]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=2018</guid>
		<description><![CDATA[Let sandwich.xml be a file at /tmp directory with the content above. &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#160; &#60;bread sesame=&#34;true&#34;&#62; &#60;catchup/&#62; &#60;hamburguer/&#62; &#60;cheese type=&#34;chedar&#34;/&#62; &#60;maionese/&#62; &#60;lettuce/&#62; &#60;/bread&#62; We can open it using java.io.FileInputStream and so use it on a javafx.data.pull.PullParser. A PullParser is a event oriented parser that works with XML and YAML files. Above a general [...]]]></description>
			<content:encoded><![CDATA[<p><center><img src="http://silveiraneto.net/wp-content/uploads/2008/12/sandwich.jpg" alt="delicious sandwich" title="delicious sandwich" width="400" height="257" class="alignnone size-full wp-image-2022" /></center></p>
<p>Let sandwich.xml be a file at /tmp directory with the content above.</p>
<div class="wp_syntax">
<div class="code">
<pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bread</span> <span style="color: #000066;">sesame</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;catchup</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;hamburguer</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cheese</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;chedar&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;maionese</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;lettuce</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bread<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre>
</div>
</div>
<p>We can open it using java.io.FileInputStream and so use it on a <a href="http://java.sun.com/javafx/1/docs/api/javafx.data.pull/javafx.data.pull.PullParser.html">javafx.data.pull.PullParser</a>. A PullParser is a event oriented parser that works with XML and YAML files. Above a general and simple parser with a GUI that show the list of events during the parse process.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileInputStream</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.data.pull.Event</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.data.pull.PullParser</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ext.swing.SwingList</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ext.swing.SwingListItem</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Scene</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.stage.Stage</span>;
&nbsp;
var list <span style="color: #339933;">=</span> SwingList <span style="color: #009900;">&#123;</span> width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">600</span> height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span> <span style="color: #009900;">&#125;</span>
&nbsp;
var myparser <span style="color: #339933;">=</span> PullParser <span style="color: #009900;">&#123;</span>
   documentType<span style="color: #339933;">:</span> PullParser.<span style="color: #006633;">XML</span>;
   onEvent<span style="color: #339933;">:</span> function <span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span> <span style="color: #003399;">Event</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      var item <span style="color: #339933;">=</span> SwingListItem <span style="color: #009900;">&#123;</span>
         text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;event {e}&quot;</span>
      <span style="color: #009900;">&#125;</span>;
      insert item into list.<span style="color: #006633;">items</span>;
   <span style="color: #009900;">&#125;</span>
   input<span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/tmp/sandwich.xml&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
myparser.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
Stage <span style="color: #009900;">&#123;</span>
   title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;XML Sandwich&quot;</span>
   scene<span style="color: #339933;">:</span> Scene <span style="color: #009900;">&#123;</span> content<span style="color: #339933;">:</span> list <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><center><img src="http://silveiraneto.net/wp-content/uploads/2008/12/javafx_xml_sandwich.png" alt="javafx xml sandwich" title="javafx xml sandwich" width="625" height="354" class="alignnone size-full wp-image-2021" /></center></p>
<p>The XML cheese element produce two the outputs.</p>
<blockquote><p>type:1 typeName:START_ELEMENT level:1 qname:cheese text:&#8221; namespaces:{} attributes:{type=chedar}<br />
type:2 typeName:END_ELEMENT level:1 qname:cheese text:&#8221; namespaces:{} attributes:{type=chedar}</p></blockquote>
<p>Notice that white spaces like tab and escape characters like new line also produced events from type TEXT. We are not interested on them. Above a parser that looks only those events of type START_ELEMENT or END_ELEMENT, look into it&#8217;s contents, building a sandwich at runtime based on the XML file.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileInputStream</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.data.pull.Event</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.data.pull.PullParser</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.data.xml.QName</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.Image</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.ImageView</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.layout.VBox</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Scene</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.stage.Stage</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// my sandwich starts as an empty VBox</span>
var mysandwich <span style="color: #339933;">=</span> VBox <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// give a name and returns a ImageView with a png image like the name</span>
function ingredient<span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">return</span> ImageView <span style="color: #009900;">&#123;</span>
      image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
         url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}{name}.png&quot;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// basicaly, look the event and put a ingredient at mysandwich</span>
var myparser <span style="color: #339933;">=</span> PullParser <span style="color: #009900;">&#123;</span>
   documentType<span style="color: #339933;">:</span> PullParser.<span style="color: #006633;">XML</span>;
   onEvent<span style="color: #339933;">:</span> function <span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span> <span style="color: #003399;">Event</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// starter xml elements</span>
      <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">type</span> <span style="color: #339933;">==</span> PullParser.<span style="color: #006633;">START_ELEMENT</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         <span style="color: #666666; font-style: italic;">// bread</span>
         <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bread&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
             insert ingredient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bread_top&quot;</span><span style="color: #009900;">&#41;</span> into mysandwich.<span style="color: #006633;">content</span>;
         <span style="color: #009900;">&#125;</span>
&nbsp;
         <span style="color: #666666; font-style: italic;">// hamburguer</span>
         <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hamburguer&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
             insert ingredient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hamburguer&quot;</span><span style="color: #009900;">&#41;</span> into mysandwich.<span style="color: #006633;">content</span>;
         <span style="color: #009900;">&#125;</span>
&nbsp;
         <span style="color: #666666; font-style: italic;">// catchup</span>
         <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;catchup&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
             insert ingredient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;catchup&quot;</span><span style="color: #009900;">&#41;</span> into mysandwich.<span style="color: #006633;">content</span>;
         <span style="color: #009900;">&#125;</span>
&nbsp;
         <span style="color: #666666; font-style: italic;">// maionese</span>
         <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;maionese&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
             insert ingredient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;maionese&quot;</span><span style="color: #009900;">&#41;</span> into mysandwich.<span style="color: #006633;">content</span>;
         <span style="color: #009900;">&#125;</span>
&nbsp;
         <span style="color: #666666; font-style: italic;">// lettuce</span>
         <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lettuce&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
             insert ingredient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lettuce&quot;</span><span style="color: #009900;">&#41;</span> into mysandwich.<span style="color: #006633;">content</span>;
         <span style="color: #009900;">&#125;</span>
&nbsp;
         <span style="color: #666666; font-style: italic;">// cheese</span>
         <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cheese&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            var type<span style="color: #339933;">=</span> e.<span style="color: #006633;">getAttributeValue</span><span style="color: #009900;">&#40;</span>QName<span style="color: #009900;">&#123;</span>name<span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;type&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>type.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cheedar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                 insert ingredient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cheedar&quot;</span><span style="color: #009900;">&#41;</span> into mysandwich.<span style="color: #006633;">content</span>;
            <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                insert ingredient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cheese&quot;</span><span style="color: #009900;">&#41;</span> into mysandwich.<span style="color: #006633;">content</span>;
            <span style="color: #009900;">&#125;</span>
         <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// ending xml elements (just bread)</span>
      <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">type</span> <span style="color: #339933;">==</span> PullParser.<span style="color: #006633;">END_ELEMENT</span><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>e.<span style="color: #006633;">qname</span>.<span style="color: #006633;">name</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bread&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            insert ingredient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bread_botton&quot;</span><span style="color: #009900;">&#41;</span> into mysandwich.<span style="color: #006633;">content</span>;
         <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
   input<span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/tmp/sandwich.xml&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
myparser.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
Stage <span style="color: #009900;">&#123;</span>
   title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;XML Sandwich&quot;</span>
   scene<span style="color: #339933;">:</span> Scene <span style="color: #009900;">&#123;</span>
      height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>
      content<span style="color: #339933;">:</span> mysandwich
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>Here&#8217;s our sandwich.</p>
<p><center><img src="http://silveiraneto.net/wp-content/uploads/2008/12/sandwich_javafx.png" alt="sandwich javaFX" title="sandwich javaFX" width="335" height="349" class="alignnone size-full wp-image-2024" /></center></p>
<p>Just changing the XML file you got a new sandwich.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #339933;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">?&gt;</span>
<span style="color: #339933;">&lt;!--</span> <span style="color: #000066; font-weight: bold;">double</span> burger <span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;</span>bread sesame<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>maionese<span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;</span>lettuce<span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;</span>hamburguer<span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;</span>cheese type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;chedar&quot;</span><span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;</span>catchup<span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;</span>hamburguer<span style="color: #339933;">/&gt;</span>
   <span style="color: #339933;">&lt;</span>lettuce<span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>bread<span style="color: #339933;">&gt;</span></pre>
</div>
</div>
<p><center><img src="http://silveiraneto.net/wp-content/uploads/2008/12/double_burguer_javafx.png" alt="double burguer " title="double burguer " width="338" height="355" class="alignnone size-full wp-image-2026" /></center></p>
<p>Bon appétit.</p>
<p>For more details on XML and JSON parsing see the <a href="http://java.sun.com/javafx/1/docs/api/javafx.data.pull/javafx.data.pull.PullParser.html">JavaFX API</a>.</p>
<p><small></p>
<ul>
<li><strong>ps:</strong> Sandwich image from <a href="http://commons.wikimedia.org/wiki/File:Lomito1.jpg">commons.wikimedia.org</a></li>
<li><strong>ps2:</strong> We&#8217;re out of sesame.</li>
<li><strong>ps3:</strong> Sources, <a href="http://silveiraneto.net/downloads/xmlsandwich.tar.bz2">xmlsandwich.tar.bz2</a>.</li>
</ul>
<p></small></p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/12/25/parsing-xml-sandwich-with-javafx/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Gravatar with JavaFX</title>
		<link>http://silveiraneto.net/2008/12/21/gravatar-with-javafx/</link>
		<comments>http://silveiraneto.net/2008/12/21/gravatar-with-javafx/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 23:26:12 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[Avatar]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[Gravatar]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[MD5]]></category>
		<category><![CDATA[MD5sum]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[vídeo]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1974</guid>
		<description><![CDATA[Gravatar is easy way to put global recognized avatar images into any Internet application. Gravatar would stands for globally recognized avatar. Below,  the Java class that I got from the Gravatar Java reference. Here is a static class called md5 that applies a MD5Sum algorithm over a string. Is a little complex code but all [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gravatar.com">Gravatar</a> is easy way to put global recognized avatar images into any Internet application. Gravatar would stands for <em>globally recognized avatar</em>.</p>
<p style="text-align: center;"><object width="656" height="320" data="http://www.youtube.com/v/VCJeqVkb4bw&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/VCJeqVkb4bw&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /></object></p>
<p>Below,  the Java class that I got from the <a title="Gravatar in Java" href="http://en.gravatar.com/site/implement/java">Gravatar Java reference</a>. Here is a static class called <em>md5</em> that applies a MD5Sum algorithm over a string. Is a little complex code but all behavior keeps encapsulated and who uses it don&#8217;t need to know how it works. Just gives a string and receives a encrypted string. Those two codes are also a good example of how calling Java classes inside a JavaFX code.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">gravatarexample</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.security.MessageDigest</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.UnsupportedEncodingException</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.security.NoSuchAlgorithmException</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MD5 <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: #003399;">String</span> toHex<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> message<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;">MessageDigest</span> md <span style="color: #339933;">=</span> <span style="color: #003399;">MessageDigest</span>.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MD5&quot;</span><span style="color: #009900;">&#41;</span>;
         <span style="color: #000066; font-weight: bold;">byte</span> array<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> md.<span style="color: #006633;">digest</span><span style="color: #009900;">&#40;</span>message.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CP1252&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
         <span style="color: #003399;">StringBuffer</span> sb <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
         <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> 0; i <span style="color: #339933;">&amp;</span>lt; array.<span style="color: #006633;">length</span>; <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">toHexString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>array<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">&amp;</span>amp;0xFF<span style="color: #009900;">&#41;</span>|0x100<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
         <span style="color: #009900;">&#125;</span>
         <span style="color: #000000; font-weight: bold;">return</span> sb.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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;">NoSuchAlgorithmException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</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;">UnsupportedEncodingException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span>;
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>As a Java class in the same package, any JavaFX (or Java) code can call it without any problem. Just to keep the code more clear I&#8217;m importing it explicitly. Is this example I also create some Swing interface to give user the option to put his mail, adjust the image size and get a output direct link or html image tag.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">gravatarexample</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">gravatarexample.MD5</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ext.swing.SwingButton</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ext.swing.SwingSlider</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ext.swing.SwingTextField</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.Image</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.ImageView</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.layout.VBox</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Scene</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.stage.Stage</span>;
&nbsp;
var mail <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Email&quot;</span>;
var key <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span>;
&nbsp;
function gravatalize<span style="color: #009900;">&#40;</span>mail<span style="color: #339933;">:</span><span style="color: #003399;">String</span>, size<span style="color: #339933;">:</span> <span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">String</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;http://www.gravatar.com/avatar/{MD5.toHex(mail)}?s={size}&quot;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
var inputtxt <span style="color: #339933;">=</span> SwingTextField <span style="color: #009900;">&#123;</span>
   columns<span style="color: #339933;">:</span> <span style="color: #cc66cc;">20</span>
   text<span style="color: #339933;">:</span> mail
<span style="color: #009900;">&#125;</span>
&nbsp;
var slider <span style="color: #339933;">=</span> SwingSlider <span style="color: #009900;">&#123;</span>
   minimum<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span>
   maximum<span style="color: #339933;">:</span> <span style="color: #cc66cc;">128</span>
   value<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>
   vertical<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">false</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
var button <span style="color: #339933;">=</span> SwingButton <span style="color: #009900;">&#123;</span>
   text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Get Gravatar&quot;</span>
   action<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      key <span style="color: #339933;">=</span> gravatalize<span style="color: #009900;">&#40;</span>inputtxt.<span style="color: #006633;">text</span>, slider.<span style="color: #006633;">value</span><span style="color: #009900;">&#41;</span>;
      directoutput.<span style="color: #006633;">text</span> <span style="color: #339933;">=</span> key;
      htmloutput.<span style="color: #006633;">text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;img src=&quot;</span><span style="color: #009900;">&#123;</span>key<span style="color: #009900;">&#125;</span><span style="color: #0000ff;">&quot; alt=&quot;</span>\<span style="color: #339933;">&amp;</span>quot;gravatar\<span style="color: #339933;">&amp;</span>quot;<span style="color: #0000ff;">&quot; /&gt;&quot;</span>;
      photo.<span style="color: #006633;">image</span> <span style="color: #339933;">=</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
         backgroundLoading<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>,
         url<span style="color: #339933;">:</span> key<span style="color: #009900;">&#125;</span>;
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
var photo<span style="color: #339933;">:</span>ImageView <span style="color: #339933;">=</span> ImageView <span style="color: #009900;">&#123;</span>
   image<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">null</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
var directoutput <span style="color: #339933;">=</span> SwingTextField <span style="color: #009900;">&#123;</span>
   columns<span style="color: #339933;">:</span> <span style="color: #cc66cc;">20</span>
   text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;direct link image&quot;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
var htmloutput <span style="color: #339933;">=</span> SwingTextField <span style="color: #009900;">&#123;</span>
   columns<span style="color: #339933;">:</span> <span style="color: #cc66cc;">20</span>
   text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;html tag image&quot;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
Stage <span style="color: #009900;">&#123;</span>
   title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Gravatar&quot;</span>
   width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>
   height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">340</span>
   scene<span style="color: #339933;">:</span> Scene <span style="color: #009900;">&#123;</span>
      content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
         VBox <span style="color: #009900;">&#123;</span>
            spacing<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span>
            content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>inputtxt, slider, button, directoutput, htmloutput, photo<span style="color: #009900;">&#93;</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></pre>
</div>
</div>
<p>The string itself is assembled in the <em>gravatalize</em> function. You give a mail and it&#8217;s returns a Gravatar direct link to the image. There&#8217;s many cool ways to use together Gravatar and a JavaFX Internet application.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/12/21/gravatar-with-javafx/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>JavaFX SDK 1.0 on Linux</title>
		<link>http://silveiraneto.net/2008/12/06/javafx-sdk-10-on-linux/</link>
		<comments>http://silveiraneto.net/2008/12/06/javafx-sdk-10-on-linux/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 07:15:35 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfx]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[openjfx]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unofficial]]></category>
		<category><![CDATA[vídeo]]></category>
		<category><![CDATA[Weiqi Gao]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1853</guid>
		<description><![CDATA[JavaFX 1.0 is out and is absolutely amazing. You guys did really a great work on it. As I really need a working SDK on Linux to continue to study and I don&#8217;t have any Windows/Mac near me, I&#8217;m using the Weiqi Gao&#8217;s workaround. I tried to simplify a little bit more the process for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://javafx.com">JavaFX 1.0</a> is out and is absolutely amazing. You guys did really a great work on it.</p>
<p style="text-align: center;"><a title="JavaFX Site" href="http://javafx.com"><img class="size-full wp-image-1854 aligncenter" title="javafx site" src="http://silveiraneto.net/wp-content/uploads/2008/12/javafxsite.png" alt="" width="400" height="311" /></a></p>
<p>As I really need a working SDK on Linux to continue to study and I don&#8217;t have any Windows/Mac near me, I&#8217;m using the <a title="Weiqigao Blog" href="http://www.weiqigao.com/blog/2008/08/05/watch_javafx_sdk_run_on_linux.html">Weiqi Gao&#8217;s workaround</a>. I tried to simplify a little bit more the process for those who need JavaFX SDK working on Linux right now.</p>
<p><strong>Download</strong> <a title="JavaFX for Linux" href="http://silveiraneto.net/downloads/javafxsdk_linux_unofficial.tar.bz2">javafxsdk_linux_unofficial.tar.bz2</a> (~18Mb).</p>
<p>And then</p>
<blockquote><p>tar -xjvf javafxsdk_linux_unofficial.tar.bz2<br />
sudo cp javafx /opt/javafx<br />
echo &#8220;PATH=\$PATH:/opt/javafx/bin&#8221; &gt;&gt; ~/.profile<br />
echo &#8220;JAVAFX_HOME=/opt/javafx&#8221; &gt;&gt; ~/.profile<br />
source ~/.profile</p></blockquote>
<p>Now you can call javafx, javafxc, javafxdoc and javafxpackager from your terminal. Don&#8217;t forget that you need Java 1.6 or greater installed.</p>
<p>Here&#8217;s a video showing the SDK working, I&#8217;m compiling and running two sample applications. Remeber that as a temporary unofficial port for Linux, there&#8217;s not native video support nor hardware acceleration.</p>
<p style="text-align: center;"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/ENf5mXEIiD8&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/ENf5mXEIiD8&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/12/06/javafx-sdk-10-on-linux/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>JavaFX, Defuse the Bomb</title>
		<link>http://silveiraneto.net/2008/11/06/javafx-defuse-the-bomb/</link>
		<comments>http://silveiraneto.net/2008/11/06/javafx-defuse-the-bomb/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 14:55:32 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[Bomb]]></category>
		<category><![CDATA[Collision]]></category>
		<category><![CDATA[defuse]]></category>
		<category><![CDATA[explosion]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java Web Start]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[JNLP]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[openjfx]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[sources]]></category>
		<category><![CDATA[webgame]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1667</guid>
		<description><![CDATA[I continue to develop simple games demos to feel better the strengths and weakness of JavaFX for game development. Preview: Click to play via Java Web Start: There&#8217;s a little JavaFX game demo where you have to transport a bomb to a defuse point without touching in the walls. I&#8217;m using the collision detection methods [...]]]></description>
			<content:encoded><![CDATA[<p>I continue to develop simple games demos to feel better the strengths and weakness of JavaFX for game development.</p>
<p><strong>Preview:</strong></p>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/hR2LiKiBUgE&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/hR2LiKiBUgE&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></center></p>
<p><strong>Click to play via Java Web Start:</strong></p>
<p style="text-align: center;"><a title="Click to launch" href="http://silveiraneto.net/downloads/Defuse/dist/launch.jnlp"><img class="size-full wp-image-1474 aligncenter" title="webstart" src="../wp-content/uploads/2008/10/webstart.png" alt="" width="88" height="23" /></a></p>
<p>There&#8217;s a little JavaFX game demo where you have to transport a bomb to a defuse point without touching in the walls. I&#8217;m using the collision detection methods <a href="http://silveiraneto.net/2008/10/30/javafx-rectangular-collision-detection/">I described early in this post</a> to detect when the bomb hits a wall and then explode or when a bomb is inside the defuse point and the game ends. As it&#8217;s only a demo, it&#8217;s just one single level, but adding more levels would be easy.</p>
<p>Basically we have this four images:</p>
<p><a href="http://silveiraneto.net/wp-content/uploads/2008/11/bomb.png"><img class="alignnone size-full wp-image-1684" title="bomb" src="http://silveiraneto.net/wp-content/uploads/2008/11/bomb.png" alt="" width="80" height="41" /><br />
bomb.png</a></p>
<p><a href="http://silveiraneto.net/wp-content/uploads/2008/11/goal.png"><img class="alignnone size-full wp-image-1686" title="goal" src="http://silveiraneto.net/wp-content/uploads/2008/11/goal.png" alt="" width="120" height="72" /><br />
goal.png</a></p>
<p><a href="http://silveiraneto.net/wp-content/uploads/2008/11/floor.png"><img class="alignnone size-thumbnail wp-image-1685" title="floor" src="http://silveiraneto.net/wp-content/uploads/2008/11/floor-150x150.png" alt="" width="150" height="150" /><br />
floor.png</a></p>
<p><a href="http://silveiraneto.net/wp-content/uploads/2008/11/wall.png"><img class="alignnone size-thumbnail wp-image-1687" title="wall" src="http://silveiraneto.net/wp-content/uploads/2008/11/wall-150x150.png" alt="" width="150" height="150" /><br />
wall.png</a></p>
<p>The code is petty simple. A little bit more than 300 lines with even with all comments and declarations. I transform the bomb image into a draggable node, create a list of collidable nodes and a especial node, the goal. I check the collisions when the bomb is dragged by mouse, if it hits something, it blows up.</p>
<p>I use extensively the TimeLine class from the animation framework (javafx.animation) to create chained animations and even to control some game logic.</p>
<p>As I focused in the simplicity, I don&#8217;t declared any classes to after instantiate their objects. I just was using common classes from JavaFX and putting logic on ir throught event and binding to external variables.</p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.Frame</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.Stage</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.animation.Timeline</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.animation.KeyFrame</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.animation.Interpolator</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.ImageView</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.Image</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Group</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Node</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.paint.Color</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.Circle</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.Rectangle</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.Shape</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.text.Text</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.Font</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.FontStyle</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.input.MouseEvent</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">/* Fade variable modified in some animations and used in the fadescreen */</span>
var fade <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">/* The Bomb */</span>
var lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span>;
var tx <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var ty <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var bomb<span style="color: #339933;">:</span>Node <span style="color: #339933;">=</span> <span style="color: #003399;">Group</span><span style="color: #009900;">&#123;</span>
    opacity<span style="color: #339933;">:</span> bind bombfade;
    content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        ImageView <span style="color: #009900;">&#123;</span>
            image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
                url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}/bomb.png&quot;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>,
        Circle <span style="color: #009900;">&#123;</span>
            centerX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">45</span>, centerY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">21</span>, radius<span style="color: #339933;">:</span> <span style="color: #cc66cc;">7</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">LIME</span>
            opacity<span style="color: #339933;">:</span> bind led
        <span style="color: #009900;">&#125;</span>,
        Circle <span style="color: #009900;">&#123;</span>
            centerX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">30</span>, centerY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">30</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">WHITE</span>
            radius<span style="color: #339933;">:</span> bind fireradius
        <span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>,
    var startX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    var startY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    translateX<span style="color: #339933;">:</span> bind tx
    translateY<span style="color: #339933;">:</span> bind ty
&nbsp;
    onMousePressed<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span> e<span style="color: #339933;">:</span> <span style="color: #003399;">MouseEvent</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>lock<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">return</span>;<span style="color: #009900;">&#125;</span>
        startX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> tx;
        startY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> ty;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    onMouseDragged<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>lock<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">return</span>;<span style="color: #009900;">&#125;</span>
        tx <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> startX;
        ty <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> startY;
        checkcollissions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Big rectangle that covers all the screen (bomb explosion or game end) */</span>
var fadescreen <span style="color: #339933;">=</span> <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span>
    x<span style="color: #339933;">:</span> 0, y<span style="color: #339933;">:</span> 0, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">640</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">480</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">WHITE</span>
    opacity<span style="color: #339933;">:</span> bind fade
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* The wood floor image for the scenario. */</span>
var floor <span style="color: #339933;">=</span> ImageView <span style="color: #009900;">&#123;</span>
    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}/floor.png&quot;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* The goal image where the bomb should be placed. */</span>
var goal <span style="color: #339933;">=</span> ImageView <span style="color: #009900;">&#123;</span>
    x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">470</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">360</span>
    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
        url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}/goal.png&quot;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* List of obstacles nodes that the bomb can collide with. */</span>
var obstacles <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
    <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>, y<span style="color: #339933;">:</span> 0, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span><span style="color: #009900;">&#125;</span>,
    <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">350</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">200</span>, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span><span style="color: #009900;">&#125;</span>,
    <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">370</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>, fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span><span style="color: #009900;">&#125;</span>,
    <span style="color: #003399;">Rectangle</span> <span style="color: #009900;">&#123;</span>
        x<span style="color: #339933;">:</span> <span style="color: #cc66cc;">250</span>, y<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>, translateX<span style="color: #339933;">:</span> bind move, width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>
        fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span>
    <span style="color: #009900;">&#125;</span>,
<span style="color: #009900;">&#93;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">/* Visible representations of obstacles */</span>
var wallimage <span style="color: #339933;">=</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span>
    url<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{__DIR__}/wall.png&quot;</span>
<span style="color: #009900;">&#125;</span>
var walls <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>obs in obstacles<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    ImageView <span style="color: #009900;">&#123;</span>
        x<span style="color: #339933;">:</span> obs.<span style="color: #006633;">x</span>, y<span style="color: #339933;">:</span> obs.<span style="color: #006633;">y</span>, translateX<span style="color: #339933;">:</span> bind obs.<span style="color: #006633;">translateX</span>
        clip<span style="color: #339933;">:</span> obs, image<span style="color: #339933;">:</span> wallimage
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Animation for a blinking green led */</span>
var led <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var bombclock <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    autoReverse<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 0s
            values <span style="color: #339933;">:</span> led <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 1s
            values <span style="color: #339933;">:</span> led <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Animation for the bomb explosion and game reset */</span>
var fireradius <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var explosion<span style="color: #339933;">:</span>Timeline <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 0s
            values <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
                fireradius <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>,
                fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
            <span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 2s
            values <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
                fireradius <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">200.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>,
                fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
            <span style="color: #009900;">&#93;</span>
            action<span style="color: #339933;">:</span> gamereset
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 3s
            values<span style="color: #339933;">:</span> fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Reset variables for initial values */</span>
function gamereset<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span>;
    fireradius <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    tx <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    ty <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    bombfade <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1.0</span>;
&nbsp;
    moveblock.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    specialcollison.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    bombclock.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Animation when the bomb reaches the goal. Bomb disapear. */</span>
var bombfade <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1.0</span>;
var bomdisapear <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 1s
            values<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
                        bombfade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span> tween Interpolator.<span style="color: #006633;">EASEBOTH</span>,
                        fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
            <span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 2s
            values<span style="color: #339933;">:</span>
                    fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>;
            action<span style="color: #339933;">:</span> gamereset
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 3s
            values<span style="color: #339933;">:</span>
                    fade <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>;
        <span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Animation for a moving block. */</span>
var move <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var moveblock <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    autoReverse<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 0s
            values <span style="color: #339933;">:</span>
                    move <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 3s
            values <span style="color: #339933;">:</span>
                    move <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">200.0</span> tween Interpolator.<span style="color: #006633;">EASEBOTH</span>
        <span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Check and handle possible collisions. */</span>
function checkcollissions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>checkobstacles<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span>;
        specialcollison.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        moveblock.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        explosion.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>insidenode<span style="color: #009900;">&#40;</span>bomb,goal<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span>;
        moveblock.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        bomdisapear.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* There was a bug, when the bomb is stopped, not been gragged, in front of
the moving block, it could pass through it because checkcollissions() was
only called on mouse moving. This make sure checking this special case. */</span>
var specialcollison<span style="color: #339933;">:</span>Timeline <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time <span style="color: #339933;">:</span> 1s<span style="color: #339933;">/</span><span style="color: #cc66cc;">5</span>
            action<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><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>hitnode<span style="color: #009900;">&#40;</span>obstacles<span style="color: #009900;">&#91;</span>sizeof obstacles<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>, bomb<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    lock <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span>;
                    moveblock.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    explosion.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    specialcollison.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                <span style="color: #009900;">&#125;</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>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
* The next four functions are for collision detection.
* @See http://silveiraneto.net/2008/10/30/javafx-rectangular-collision-detection/
*/</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Check collision between two rectangles.
 */</span>
function collission<span style="color: #009900;">&#40;</span>ax, ay, bx, by, cx, cy, dx, dy<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Boolean</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> not <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ax <span style="color: #339933;">&gt;</span> dx<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>bx <span style="color: #339933;">&lt;</span> cx<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>ay <span style="color: #339933;">&gt;</span> dy<span style="color: #009900;">&#41;</span>or<span style="color: #009900;">&#40;</span>by <span style="color: #339933;">&lt;</span> cy<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Check if the first rectangle are inside the second.
 */</span>
function inside <span style="color: #009900;">&#40;</span>ax, ay, bx, by, cx, cy, dx, dy<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ax <span style="color: #339933;">&gt;</span> cx<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>bx <span style="color: #339933;">&lt;</span> dx<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>ay <span style="color: #339933;">&gt;</span> cy<span style="color: #009900;">&#41;</span> and <span style="color: #009900;">&#40;</span>by <span style="color: #339933;">&lt;</span> dy<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
function hitnode<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">:</span> Node, b<span style="color: #339933;">:</span>Node<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Boolean</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>collission<span style="color: #009900;">&#40;</span>
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
function insidenode<span style="color: #009900;">&#40;</span>a<span style="color: #339933;">:</span>Node,b<span style="color: #339933;">:</span>Node<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Boolean</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>inside<span style="color: #009900;">&#40;</span>
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        a.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, a.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> a.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
        b.<span style="color: #006633;">getBoundsX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, b.<span style="color: #006633;">getBoundsY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> b.<span style="color: #006633;">getHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
* Check collision of bomb against each obstacle.
*/</span>
function checkobstacles<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #003399;">Boolean</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>obst in obstacles<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>hitnode<span style="color: #009900;">&#40;</span>obst, bomb<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Pack visual game elements in a Frame's Stage, unresizable. */</span>
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Defuse the Bomb&quot;</span>
    width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">640</span>
    height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">480</span>
    resizable<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">false</span>
    closeAction<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">System</span>.<span style="color: #006633;">exit</span><span style="color: #009900;">&#40;</span> 0 <span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
&nbsp;
    stage<span style="color: #339933;">:</span> Stage <span style="color: #009900;">&#123;</span>
        content<span style="color: #339933;">:</span> bind <span style="color: #009900;">&#91;</span>floor, goal, walls, bomb, fadescreen<span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Call gamereset to set initial values and start animations */</span>
gamereset<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre>
</div>
</div>
<p><strong>Downloads:</strong></p>
<ul>
<li>High definition video, <a href="http://http://silveiraneto.net/downloads/javafx_defuse.ogv">javafx_defuse.ogv</a>.</li>
<li>Entire project with sources and resources for NetBeans 6.1 with JavaFX pluggin, <a title="NetBeans project" href="http://silveiraneto.net/downloads/defuse.tar.bz2">defuse.tar.bz2</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/11/06/javafx-defuse-the-bomb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JavaFX Overview Slides</title>
		<link>http://silveiraneto.net/2008/10/19/javafx-overview-slides/</link>
		<comments>http://silveiraneto.net/2008/10/19/javafx-overview-slides/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 01:35:03 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[café com tapioca]]></category>
		<category><![CDATA[CEJUG]]></category>
		<category><![CDATA[Faculdade Christus]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jug]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[vídeo]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1485</guid>
		<description><![CDATA[My slides about a overview on JavaFX at our last CEJUG event. JavaFX Overview View SlideShare presentation or Upload your own. (tags: javafx ria) Downloads: javafx_cct_cejug_oct_2008.odp javafx_cct_cejug_oct_2008.pdf Here a little screncast showing the live preview feature on the NetBeans JavaFX Plugin. You can also download the orignal screencast in higher resolution netbeans_javafx_preview.ogg (15 Mb). Photos [...]]]></description>
			<content:encoded><![CDATA[<p>My slides about a overview on JavaFX at our <a href="http://www.cejug.org/pages/viewpage.action?pageId=32014362">last CEJUG event</a>.</p>
<p><center>
<div style="width:425px;text-align:left" id="__ss_670449"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/silveiraneto/javafx-overview-presentation?type=powerpoint" title="JavaFX Overview">JavaFX Overview</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=javafxcctcejugoct2008-1224465285764069-8&#038;stripped_title=javafx-overview-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=javafxcctcejugoct2008-1224465285764069-8&#038;stripped_title=javafx-overview-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/silveiraneto/javafx-overview-presentation?type=powerpoint" title="View JavaFX Overview on SlideShare">presentation</a> or <a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint">Upload</a> your own. (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/javafx">javafx</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/ria">ria</a>)</div>
</div>
<p></center></p>
<p><strong>Downloads:</strong></p>
<ul>
<li><a href="http://silveiraneto.net/downloads/javafx_cct_cejug_oct_2008.odp">javafx_cct_cejug_oct_2008.odp</a></li>
<li><a href="http://silveiraneto.net/downloads/javafx_cct_cejug_oct_2008.pdf">javafx_cct_cejug_oct_2008.pdf</a></li>
</ul>
<p style="text-align: center;"><img src='http://farm4.static.flickr.com/3002/2956858644_4870fa0b27.jpg' alt='Café com Tapioca na Christus'/></p>
<p style="text-align: center;"><img class="aligncenter" src="http://farm4.static.flickr.com/3041/2956896062_255c8afa6f.jpg" alt="Café com Tapioca na Christus" /></p>
<p>Here a little screncast showing the live preview feature on the <a href="http://javafx.netbeans.org/">NetBeans JavaFX Plugin</a>.</p>
<p style="text-align: center;"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/vCWQtQgdpUA&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/vCWQtQgdpUA&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></p>
<p>You can also download the orignal screencast in higher resolution <a href="http://silveiraneto.net/downloads/netbeans_javafx_preview.ogg">netbeans_javafx_preview.ogg</a> (15 Mb). Photos of the presentation at <a title="CCT Christus" href="http://flickr.com/photos/silveiraneto/sets/72157608193146923/">my Flickr album</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/10/19/javafx-overview-slides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaFX, Draggable Nodes</title>
		<link>http://silveiraneto.net/2008/08/11/javafx-draggable-node/</link>
		<comments>http://silveiraneto.net/2008/08/11/javafx-draggable-node/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 19:18:34 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[Drag]]></category>
		<category><![CDATA[draggable]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[Mouse]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=1064</guid>
		<description><![CDATA[One thing that I like a lot to do with JavaFX is draggable objects. Due to some recent changes in the JavaFX syntax my old codes for that are no longer working. Joshua Marinacci from Sun&#8217;s JavaFX engineering team and other guys from the JavaFX community gave me some tips. Here some strategies I&#8217;m using [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that I like a lot to do with JavaFX is draggable objects. Due to some recent changes in the JavaFX syntax my <a href="http://silveiraneto.net/2008/02/16/draggable-and-growable-ball-in-javafx/">old codes for that</a> are no longer working. <a href="http://weblogs.java.net/blog/joshy/">Joshua Marinacci</a> from Sun&#8217;s JavaFX engineering team and other guys from the JavaFX community gave me some tips. Here some strategies I&#8217;m using for making draggable nodes in JavaFX.</p>
<p>In this first example, a simple draggable ellipse.<br />
<center><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/pAJHH-mPLaQ&#038;hl=pt-br&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/pAJHH-mPLaQ&#038;hl=pt-br&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></center><br />
video url: <a href="http://www.youtube.com/watch?v=pAJHH-mPLaQ">http://www.youtube.com/watch?v=pAJHH-mPLaQ</a></p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.paint.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.input.*</span>;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
    stage<span style="color: #339933;">:</span> Stage <span style="color: #009900;">&#123;</span>
        content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
            Ellipse <span style="color: #009900;">&#123;</span>
                var endX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>; var endY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>
                var startX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>; var startY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>
                centerX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">150</span>, centerY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">150</span>
                radiusX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">80</span>, radiusY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">40</span>
                fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">ORANGE</span>
                translateX<span style="color: #339933;">:</span> bind endX
                translateY<span style="color: #339933;">:</span> bind endY
                onMousePressed<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
                    startX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>endX;
                    startY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>endY;
                <span style="color: #009900;">&#125;</span>
                onMouseDragged<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
                    endX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>startX;
                    endY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>startY;
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#93;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>When you need to create a group of draggable objects, you can try thie approach of a draggable group like this. Inside on it, you can put whatever you want.</p>
<p><center><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/mHOcPRrgQCQ&#038;hl=pt-br&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/mHOcPRrgQCQ&#038;hl=pt-br&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></center><br />
Video url: <a href="http://www.youtube.com/watch?v=mHOcPRrgQCQ">http://www.youtube.com/watch?v=mHOcPRrgQCQ</a></p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.paint.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.input.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.effect.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.image.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.animation.*</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// a graggable group</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DragGroup <span style="color: #000000; font-weight: bold;">extends</span> CustomNode<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> attribute content<span style="color: #339933;">:</span> Node<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> attribute endX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    <span style="color: #000000; font-weight: bold;">private</span> attribute endY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> attribute startX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    <span style="color: #000000; font-weight: bold;">private</span> attribute startY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> function create<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> Node <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">Group</span><span style="color: #009900;">&#123;</span>
            translateX<span style="color: #339933;">:</span> bind endX
            translateY<span style="color: #339933;">:</span> bind endY
            content<span style="color: #339933;">:</span> bind content
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    override attribute onMousePressed <span style="color: #339933;">=</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        startX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>endX;
        startY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>endY;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    override attribute onMouseDragged <span style="color: #339933;">=</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        endX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>startX;
        endY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>startY;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// angle animation, cycles between 0 to 360 in 36 seconds</span>
var angle <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var angleAnimation <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time<span style="color: #339933;">:</span> 0s
            values<span style="color: #339933;">:</span>
                    angle <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame<span style="color: #009900;">&#123;</span>
            time<span style="color: #339933;">:</span> 36s
            values <span style="color: #339933;">:</span>
                    angle <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">360.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// some pictures from my Flickr albums </span>
var me    <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://farm4.static.flickr.com/3042/2746737338_aa3041f283_m.jpg&quot;</span>;
&nbsp;
&nbsp;
&nbsp;
var dog   <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://farm4.static.flickr.com/3184/2717290793_ec14c26a85_m.jpg&quot;</span>;
var plant <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://farm4.static.flickr.com/3014/2731177705_bed6d6b8fa_m.jpg&quot;</span>;
var bird  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://farm4.static.flickr.com/3190/2734919599_a0110e7ce0_m.jpg&quot;</span>;
var me_89  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://farm3.static.flickr.com/2138/2308085138_7b296cc5d0_m.jpg&quot;</span>;
&nbsp;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">640</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">480</span>, visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
    stage<span style="color: #339933;">:</span> Stage <span style="color: #009900;">&#123;</span>
        fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span>
        content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
            DragGroup<span style="color: #009900;">&#123;</span>
                content<span style="color: #339933;">:</span> ImageView <span style="color: #009900;">&#123;</span>
                    anchorX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>, anchorY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">90</span>
                    rotate<span style="color: #339933;">:</span> bind <span style="color: #cc66cc;">30</span> <span style="color: #339933;">+</span> angle
                    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span> backgroundLoading<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>, url<span style="color: #339933;">:</span> me <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>,
            DragGroup <span style="color: #009900;">&#123;</span>
                translateX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, translateY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>
                content<span style="color: #339933;">:</span> ImageView <span style="color: #009900;">&#123;</span>
                    anchorX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>, anchorY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">90</span>
                    rotate<span style="color: #339933;">:</span> bind <span style="color: #339933;">-</span><span style="color: #cc66cc;">30</span> <span style="color: #339933;">+</span> angle
                    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span> backgroundLoading<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>, url<span style="color: #339933;">:</span> dog <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>,
            DragGroup <span style="color: #009900;">&#123;</span>
                translateX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>, translateY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>
                content<span style="color: #339933;">:</span> ImageView <span style="color: #009900;">&#123;</span>
                    anchorX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>, anchorY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">90</span>
                    rotate<span style="color: #339933;">:</span> bind <span style="color: #cc66cc;">90</span> <span style="color: #339933;">+</span> angle
                    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span> backgroundLoading<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>, url<span style="color: #339933;">:</span> plant <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>,
            DragGroup <span style="color: #009900;">&#123;</span>
                translateX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">200</span>
                translateY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">200</span>
                content<span style="color: #339933;">:</span> ImageView <span style="color: #009900;">&#123;</span>
                    anchorX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>, anchorY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">90</span>
                    rotate<span style="color: #339933;">:</span> bind <span style="color: #cc66cc;">90</span> <span style="color: #339933;">+</span> angle
                    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span> backgroundLoading<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>, url<span style="color: #339933;">:</span> bird <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>,
            DragGroup <span style="color: #009900;">&#123;</span>
                translateX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">30</span>
                translateY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">200</span>
                content<span style="color: #339933;">:</span> ImageView <span style="color: #009900;">&#123;</span>
                    anchorX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">85</span>, anchorY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>
                    rotate<span style="color: #339933;">:</span> bind angle <span style="color: #339933;">+</span> <span style="color: #cc66cc;">180</span>
                    image<span style="color: #339933;">:</span> <span style="color: #003399;">Image</span> <span style="color: #009900;">&#123;</span> backgroundLoading<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>, url<span style="color: #339933;">:</span> me_89 <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>,
        <span style="color: #009900;">&#93;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    closeAction<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">System</span>.<span style="color: #006633;">exit</span><span style="color: #009900;">&#40;</span> 0 <span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
angleAnimation.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre>
</div>
</div>
<p>One more example, using the same class DragGroup, we can put multiple nodes using lists.</p>
<p><center><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/gJqy7EdtEqs&#038;hl=pt-br&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/gJqy7EdtEqs&#038;hl=pt-br&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></center><br />
Video url: <a href="http://www.youtube.com/watch?v=gJqy7EdtEqs">http://www.youtube.com/watch?v=gJqy7EdtEqs</a></p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.application.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.geometry.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.scene.paint.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.input.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.animation.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.Math</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">// Class to create a draggable group of objects</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DragGroup <span style="color: #000000; font-weight: bold;">extends</span> CustomNode<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> attribute content<span style="color: #339933;">:</span> Node<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> attribute endX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    <span style="color: #000000; font-weight: bold;">private</span> attribute endY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> attribute startX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
    <span style="color: #000000; font-weight: bold;">private</span> attribute startY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
&nbsp;
    override attribute onMousePressed <span style="color: #339933;">=</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        startX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>endX;
        startY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>endY;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    override attribute onMouseDragged <span style="color: #339933;">=</span> function<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">:</span><span style="color: #003399;">MouseEvent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
        endX <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>startX;
        endY <span style="color: #339933;">=</span> e.<span style="color: #006633;">getDragY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>startY;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> function create<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> Node <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">Group</span><span style="color: #009900;">&#123;</span>
            translateX<span style="color: #339933;">:</span> bind endX
            translateY<span style="color: #339933;">:</span> bind endY
            content<span style="color: #339933;">:</span> bind content
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// angle animation, cycles between 0 to 360 in 10 seconds</span>
var angle <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var angleAnimation <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time<span style="color: #339933;">:</span> 0s
            values<span style="color: #339933;">:</span> angle <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame<span style="color: #009900;">&#123;</span>
            time<span style="color: #339933;">:</span> 10s
            values <span style="color: #339933;">:</span>  angle <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">360.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// breath animation, go and back from 0.0 to 10.0 in 2 seconds</span>
var breath <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0.0</span>;
var breathAnimation <span style="color: #339933;">=</span> Timeline <span style="color: #009900;">&#123;</span>
    repeatCount<span style="color: #339933;">:</span> Timeline.<span style="color: #006633;">INDEFINITE</span>
    autoReverse<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
    keyFrames <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        KeyFrame <span style="color: #009900;">&#123;</span>
            time<span style="color: #339933;">:</span> 0s
            values<span style="color: #339933;">:</span> breath <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0.0</span>
        <span style="color: #009900;">&#125;</span>,
        KeyFrame<span style="color: #009900;">&#123;</span>
            time<span style="color: #339933;">:</span> 1s
            values <span style="color: #339933;">:</span>  breath <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">10.0</span> tween Interpolator.<span style="color: #006633;">LINEAR</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Creates n multi colored floating circles around a bigger circle</span>
var n <span style="color: #339933;">=</span> <span style="color: #cc66cc;">12</span>;
var colors <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
    <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLUE</span>, <span style="color: #003399;">Color</span>.<span style="color: #006633;">AQUA</span>, <span style="color: #003399;">Color</span>.<span style="color: #006633;">MAGENTA</span>, <span style="color: #003399;">Color</span>.<span style="color: #006633;">RED</span>,
    <span style="color: #003399;">Color</span>.<span style="color: #006633;">YELLOW</span>, <span style="color: #003399;">Color</span>.<span style="color: #006633;">ORANGE</span>, <span style="color: #003399;">Color</span>.<span style="color: #006633;">HOTPINK</span>, <span style="color: #003399;">Color</span>.<span style="color: #006633;">LIME</span>
<span style="color: #009900;">&#93;</span>;
var chosen <span style="color: #339933;">=</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">YELLOW</span>;
var floatingCircles <span style="color: #339933;">=</span> <span style="color: #003399;">Group</span><span style="color: #009900;">&#123;</span>
    rotate<span style="color: #339933;">:</span> bind angle
    content<span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i in <span style="color: #009900;">&#91;</span>1..<span style="color: #006633;">n</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
    Circle <span style="color: #009900;">&#123;</span>
        fill<span style="color: #339933;">:</span> colors<span style="color: #009900;">&#91;</span>i mod sizeof colors<span style="color: #009900;">&#93;</span>
        radius<span style="color: #339933;">:</span> <span style="color: #cc66cc;">10</span>
        centerX<span style="color: #339933;">:</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">cos</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">*</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">PI</span><span style="color: #339933;">/</span>n<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">70</span>
        centerY<span style="color: #339933;">:</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">sin</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">*</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">*</span> <span style="color: #003399;">Math</span>.<span style="color: #006633;">PI</span><span style="color: #339933;">/</span>n<span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">70</span>
        onMouseClicked<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span> e<span style="color: #339933;">:</span> <span style="color: #003399;">MouseEvent</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #003399;">Void</span> <span style="color: #009900;">&#123;</span>
            chosen <span style="color: #339933;">=</span> colors<span style="color: #009900;">&#91;</span>i mod sizeof colors<span style="color: #009900;">&#93;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
var circle <span style="color: #339933;">=</span> Circle<span style="color: #009900;">&#123;</span>
    radius<span style="color: #339933;">:</span> bind <span style="color: #cc66cc;">50</span> <span style="color: #339933;">+</span> breath
    fill<span style="color: #339933;">:</span> bind chosen
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">400</span>, height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">400</span>, visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
    stage<span style="color: #339933;">:</span> Stage <span style="color: #009900;">&#123;</span>
        fill<span style="color: #339933;">:</span> <span style="color: #003399;">Color</span>.<span style="color: #006633;">BLACK</span>
        content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
            DragGroup<span style="color: #009900;">&#123;</span>
                translateX<span style="color: #339933;">:</span> <span style="color: #cc66cc;">200</span>, translateY<span style="color: #339933;">:</span> <span style="color: #cc66cc;">200</span>
                content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>circle, floatingCircles<span style="color: #009900;">&#93;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    closeAction<span style="color: #339933;">:</span> function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">System</span>.<span style="color: #006633;">exit</span><span style="color: #009900;">&#40;</span> 0 <span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// starts all animations</span>
angleAnimation.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
breathAnimation.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/08/11/javafx-draggable-node/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

