<?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; english</title>
	<atom:link href="http://silveiraneto.net/tag/english/feed/" rel="self" type="application/rss+xml" />
	<link>http://silveiraneto.net</link>
	<description></description>
	<lastBuildDate>Fri, 09 Mar 2012 04:13:27 +0000</lastBuildDate>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Netbeans: your first plugin</title>
		<link>http://silveiraneto.net/2008/02/24/netbeans-your-first-plugin/</link>
		<comments>http://silveiraneto.net/2008/02/24/netbeans-your-first-plugin/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 17:19:17 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dialogs API]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[helloyou]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/24/netbeans-your-first-plugin/</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/02/24/netbeans-your-first-plugin/" title="Netbeans: your first plugin"></a>Netbeans have a modular architecture that permits plug and unplug functionalities easily using the Plugin Manager. It&#8217;s also easy create new plugins using Netbeans itself.http://silveiraneto.net/wp-admin/media-upload.php?post_id=705&#038;TB_iframe=true 1º Step: A new module. Create a New Project clicking in File → New Project. &#8230;<p class="read-more"><a href="http://silveiraneto.net/2008/02/24/netbeans-your-first-plugin/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/02/24/netbeans-your-first-plugin/" title="Netbeans: your first plugin"></a><p>Netbeans have a <a href="http://www.netbeans.org/features/platform/index.html">modular architecture</a> that permits plug and unplug functionalities easily using the <em>Plugin Manager</em>.</p>
<p>It&#8217;s also easy create new plugins using Netbeans itself.http://silveiraneto.net/wp-admin/media-upload.php?post_id=705&#038;TB_iframe=true</p>
<p><span id="more-705"></span></p>
<p><strong>1º Step: A new module.</strong></p>
<p>Create a New Project clicking in <em>File → New Project</em>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/filenewproject.png" alt="Netbeans: File → New Project" /><br />
<small>Figure 1. Creating a new project</small></p>
<p>In <em>Categories</em> select <em>Netbeans Module</em> and in <em>Projects</em> select <em>Module</em>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/newmodule.png" alt="Netbeans New Module" /><br />
<small>Figure 2. Creating a new module.</small></p>
<p>Click in <em>Next</em>.</p>
<p>In the next screen you can choose your module name, like HelloYou. Leave the rest with the default values.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/nameandlocation.png" alt="Netbeans Module Name and Location" /><br />
<small>Figure 3. Naming the module.</small></p>
<p>Now you have to set up the package base name, something like <em>org.yourorg.helloyou</em>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/basicmoduleconfiguration.png" alt="Basic Module Configuration" /><br />
<small>Figure 4. Package name.</small></p>
<p>Now you have an empty module, but we need some action.</p>
<p><strong>2º Step: Some action.</strong></p>
<p>Right click in your source package and click in <strong>New → Action</strong>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/newaction.png" alt="Netbeans Add Action" /><br />
<small>Figure 5. Adding some action.</small></p>
<p>Now we&#8217;ll fill another wizard. The first screen is about <em>Action Type</em>. Leave all with the default values (the <em>Always Enabled</em> option) and click <em>Next</em>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/actiontype.png" alt="Action Type" /><br />
<small>Figure 6. Filling the Action Type.</small></p>
<p>In the <em>GUI Registration</em> screen we can set where we want our action appears as an menu item. We chose Menu file and select <em>Global Toolbar Button</em>. In <em>Toolbar</em> select <em>Build</em> and in <em>Position</em> select <em>Profile Main Project&#8230;- HERE</em>. Click <em>Next</em>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/guiregistration.png" alt="Gui Registration" /><br />
<small>Figure 7. GUI Registration.</small></p>
<p>Now we will set up the screen <em>Name, Icon and Location</em>. In <em>Class Name</em> we choose HelloAction. Display Name is how the class will appear in the menu, so we can spaces. You should select an icon in dimensions of 16&#215;16. In the same directory you can put to an icon in 24&#215;24. If your 16&#215;16 icon is named ball.png your 24&#215;24 icon should be ball24.png. Doesn&#8217;t matter where is this icon, it&#8217;ll be automatically copied to the module directory.  Now click <strong>Finish</strong>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/nameiconlocation.png" alt="Netbeans Name Icon and Location." /><br />
<small>Figure 8. Name, Icon and Location.<br />
</small></p>
<p>I used an smile icon from the <a href="http://www.pidgin.im/">Pidgin Project</a>.</p>
<p><img src="http://silveiraneto.net/wp-content/uploads/2008/02/wink.png" alt="Wink" /><img src="http://silveiraneto.net/wp-content/uploads/2008/02/wink24.png" alt="Wink24" /></p>
<p>After clicked in <strong>Finish</strong> your project will look like that:</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/likethatcode.png" alt="Look like that" /><br />
<small>Figure 9. Empty action.<br />
</small></p>
<p>At this point we can already test our module! For doing that right click in <img src="http://silveiraneto.net/wp-content/uploads/2008/02/puzzle1.png" alt="Puzzle" /><em>HelloYou</em> (puzzle icon) and select <em>Install/Reload in Target Platform</em>. This will open a new instance of Netbeans with your module installed!</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/firstinstallreloadintargetplatform.png" alt="Install or reload in target platform" /><br />
<small>Figure 10. Install/Reload in target platform.</small></p>
<p>If everything goes alright you will see your icon in the toolbar.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/noticethesmile.png" alt="Notice the smile" /><br />
<small>Figure 11. Look! We got an plugin!<br />
</small></p>
<p>But if you click in the smile nothing happens. We have defined no action at all.</p>
<p><strong>3º Step: Creating dependencies.</strong></p>
<p>A module can have dependencies from others modules. When you try to install it, Netbeans will ask about install their modules dependencies. Is much like an Linux package system.</p>
<p>We can see and set up the dependencies in our module properties screen. You can right click <img src="http://silveiraneto.net/wp-content/uploads/2008/02/puzzle1.png" alt="Puzzle" /><em>HelloYou</em> and go in <em>Properties</em>. Another way to do the same is going in <em>File → &#8220;HelloYou&#8221; Properties</em>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/menuhelloyouproperties.png" alt="Helloyou properties" /><br />
<small>Figure 12. File → &#8220;HelloYou&#8221; Properties.<br />
</small></p>
<p>In the <em>Project Properties</em> screen select <em>Libraries</em> in the left side, <em>Categories</em>. There are listed the Java, Netbeans and all <em>Module Dependencies</em> of your module. By default you&#8217;ll see <em>Utilities API</em> module dependence.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/projectproperties.png" alt="Netbeans Project Properties" /><br />
<small>Figure 13. Module Dependences.</small></p>
<p>Click in the button <em>Add </em>(that one near the module dependencies). You&#8217;ll see the <em>Add Module Dependency</em> screen where are listed all Netbeans modules.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/addmodulesdependencies.png" alt="Netbeans add modules dependency" /><br />
<small>Figure 14. Add Modules Dependency</small></p>
<p>We want add an dependency for the <em>Dialogs API</em>. Type &#8220;dialogs&#8221; in the filter text field.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/dialogsapi.png" alt="Netbeans Dialogs API" /><br />
<small>Figure 15. Dialogs API.</small></p>
<p>Select the module <em>Dialogs API</em> and click <em>OK</em>. Now our module have two dependencies: <em>Utilities API</em> and <em>Dialogs API</em>.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/moremodulesdependecies.png" alt="More module dependencies" /><br />
<small>Figure 16. Dialogs API and Utilities API. </small></p>
<p>Now for the first time, let&#8217;s right some code.</p>
<p>In HelloAction.java file there&#8217;s a class <em>HelloAction</em> that extends <a href="http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/actions/CallableSystemAction.html" title="Netbeans API"><em>CallableSystemAction</em></a> (an abstract class). In the method <em>performAction</em>() there&#8217;s nothing but:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//TODO implement action body</span></pre></div></div>

<p>We will rewrite the <em>performAction</em> method:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> performAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #003399;">String</span> msg <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Hello Netbeans World!&quot;</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">int</span> msgType <span style="color: #339933;">=</span> NotifyDescriptor.<span style="color: #006633;">INFORMATION_MESSAGE</span><span style="color: #339933;">;</span>
   NotifyDescriptor d <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NotifyDescriptor.<span style="color: #006633;">Message</span><span style="color: #009900;">&#40;</span>msg, msgType<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   DialogDisplayer.<span style="color: #006633;">getDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">notify</span><span style="color: #009900;">&#40;</span>d<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You will see some warnings (cannot find symbol). Just fix the imports (Ctrl+Shift+I). To test your module, do it again: <img src="http://silveiraneto.net/wp-content/uploads/2008/02/puzzle1.png" alt="Puzzle" /><em>HelloYou</em> → <em>Install/Reload in Target Platform</em>. A new instance of Netbeans will open and you&#8217;ll see our smile face button again. When you click it, Netbeans will show an dialog.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/netbeanshelloworld.png" alt="Netbeans Hello World" /><br />
<small>Figure 17. Hello Netbeans World.</small></p>
<p>Let&#8217;s do more. Let&#8217;s talk with the user using <em><a href="http://bits.netbeans.org/dev/javadoc/org-openide-dialogs/org/openide/NotifyDescriptor.InputLine.html">NotifyDescriptor.InputLine</a></em>. Will create an input line dialog, get the user name (if he clicks in Ok) and display a message to him.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> performAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    NotifyDescriptor.<span style="color: #006633;">InputLine</span> question<span style="color: #339933;">;</span>
    question <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NotifyDescriptor.<span style="color: #006633;">InputLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Name:&quot;</span>,
        <span style="color: #0000ff;">&quot;What's your name?&quot;</span>,
        NotifyDescriptor.<span style="color: #006633;">OK_CANCEL_OPTION</span>,
        NotifyDescriptor.<span style="color: #006633;">QUESTION_MESSAGE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>DialogDisplayer.<span style="color: #006633;">getDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">notify</span><span style="color: #009900;">&#40;</span>question<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> NotifyDescriptor.<span style="color: #006633;">OK_OPTION</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #003399;">String</span> msg <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Hello &quot;</span><span style="color: #339933;">+</span>question.<span style="color: #006633;">getInputText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;!&quot;</span><span style="color: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">int</span> msgType <span style="color: #339933;">=</span> NotifyDescriptor.<span style="color: #006633;">INFORMATION_MESSAGE</span><span style="color: #339933;">;</span>
         NotifyDescriptor d <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NotifyDescriptor.<span style="color: #006633;">Message</span><span style="color: #009900;">&#40;</span>msg, msgType<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         DialogDisplayer.<span style="color: #006633;">getDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">notify</span><span style="color: #009900;">&#40;</span>d<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Again, <img src="http://silveiraneto.net/wp-content/uploads/2008/02/puzzle1.png" alt="Puzzle" /><em>HelloYou</em> → <em>Install/Reload in Target Platform</em>.</p>
<p>After the new Netbeans instance opens, click in our smile face.</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/typeyourname.png" alt="Type your name" /></p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/hellosilveira.png" alt="Hello Silveira" /></p>
<p>That&#8217;s it. You made your Netbeans plugin!</p>
<p><strong>Learn more about Netbeans Module Development:</strong></p>
<ul>
<li><strong><a href="http://platform.netbeans.org/tutorials/quickstart-nbm.html">Introduction to NetBeans Module Development Tutorial</a></strong> &#8211; A tutorial I based to make this one.</li>
<li><strong><a href="http://www.netbeans.org/kb/trails/platform.html">NetBeans Modules and Rich-Client Applications Learning Trail</a></strong> &#8211; All resources you need to learn more about Netbeans Platform. Lot&#8217;s of tutorials.</li>
<li><strong><a href="http://plugins.netbeans.org/PluginPortal/">Netbeans Plugin Portal</a></strong> &#8211; You can download and also make a <a href="http://autoupdate.netbeans.org/nbm/nbm_package.html">NBM file</a> to share your plugins with the community.</li>
<li><strong><a href="http://www.amazon.com/Rich-Client-Programming-Plugging-NetBeans/dp/0132354802">Rich Client Programming: Plugging into the NetBeans Platform</a></strong> &#8211;  <a href="http://weblogs.java.net/blog/timboudreau/">Tim Boudreau</a>,  <a href="http://www.ohloh.net/accounts/8184">Jaroslav Tulach</a> and <a href="http://blogs.sun.com/geertjan/">Geertjan Wielenga</a> wrote the best book about Netbeans platform. I&#8217;m reading it.</li>
<li><strong><a href="http://wiki.netbeans.org/NetBeansDeveloperFAQ">Netbeans Developer FAQ</a></strong> &#8211; An big FAQ for person writing NetBeans extension modules (plug-ins), or applications based on the NetBeans platform.</li>
</ul>
<p><strong>added in 02.</strong><strong>27</strong><strong>.08:</strong> now this tutorial is also available in the <a href="http://wiki.netbeans.org/YourFirstNetbeansModule" title="Wiki">Netbeans Wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/24/netbeans-your-first-plugin/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>JavaFX: Side-scrolling</title>
		<link>http://silveiraneto.net/2008/02/20/javafx-side-scrolling/</link>
		<comments>http://silveiraneto.net/2008/02/20/javafx-side-scrolling/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 03:26:28 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfx]]></category>
		<category><![CDATA[jfxbest]]></category>
		<category><![CDATA[mountains]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[ship]]></category>
		<category><![CDATA[side scrolling]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/20/javafx-side-scrolling/</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/02/20/javafx-side-scrolling/" title="JavaFX: Side-scrolling"></a>An side-scrolling game attempt. I used two images, this mountain background made with Gimp (xcf sources here) and that ship above made with Inkscape (svg sources here). import javafx.ui.*; import javafx.ui.canvas.*; &#160; var scroll; scroll = &#91;1..800&#93; dur 60000 linear &#8230;<p class="read-more"><a href="http://silveiraneto.net/2008/02/20/javafx-side-scrolling/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/02/20/javafx-side-scrolling/" title="JavaFX: Side-scrolling"></a><p>An side-scrolling game attempt.</p>
<p><img src="http://silveiraneto.net/downloads/jfx_plane.png" alt="an plane" /></p>
<p>I used two images, <a href="http://silveiraneto.net/downloads/mountains.png">this mountain background</a> made with Gimp (<a href="http://silveiraneto.net/downloads/mountains.xcf">xcf sources here</a>) and that ship above made with Inkscape (<a href="http://silveiraneto.net/downloads/jfx_plane.svg">svg sources here</a>).</p>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/5F4STuluSiM&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/5F4STuluSiM&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></object></center></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.canvas.*</span><span style="color: #339933;">;</span>
&nbsp;
var scroll<span style="color: #339933;">;</span>
scroll <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span>..<span style="color: #cc66cc;">800</span><span style="color: #009900;">&#93;</span> dur <span style="color: #cc66cc;">60000</span> linear <span style="color: #000000; font-weight: bold;">continue</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
var mountains <span style="color: #339933;">=</span> <span style="color: #003399;">Clip</span><span style="color: #009900;">&#123;</span>
    transform<span style="color: #339933;">:</span> bind translate<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>scroll,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
    shape<span style="color: #339933;">:</span> Rect <span style="color: #009900;">&#123;</span>x<span style="color: #339933;">:</span>bind scroll, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">400</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">200</span><span style="color: #009900;">&#125;</span>
    content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>ImageView <span style="color: #009900;">&#123;</span>
            transform<span style="color: #339933;">:</span> translate<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</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;http://silveiraneto.net/downloads/mountains.png&quot;</span><span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>,
        ImageView <span style="color: #009900;">&#123;</span>
            transform<span style="color: #339933;">:</span> translate<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">800</span>,<span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</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;http://silveiraneto.net/downloads/mountains.png&quot;</span><span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
var h <span style="color: #339933;">=</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">;</span>
&nbsp;
var ship <span style="color: #339933;">=</span> ImageView <span style="color: #009900;">&#123;</span>
    cursor<span style="color: #339933;">:</span> HAND
    transform<span style="color: #339933;">:</span> bind translate<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>,h<span style="color: #009900;">&#41;</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;http://silveiraneto.net/downloads/jfx_plane.png&quot;</span><span style="color: #009900;">&#125;</span>
    onMouseDragged<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        h <span style="color: #339933;">+=</span> e.<span style="color: #006633;">localDragTranslation</span>.<span style="color: #006633;">y</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003399;">Canvas</span> <span style="color: #009900;">&#123;</span>
    content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>mountains, ship<span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/20/javafx-side-scrolling/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>More photos from Reggie and Simon in Fortaleza</title>
		<link>http://silveiraneto.net/2008/02/15/more-photos-from-reggie-and-simon-in-fortaleza/</link>
		<comments>http://silveiraneto.net/2008/02/15/more-photos-from-reggie-and-simon-in-fortaleza/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 17:26:00 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[CEJUG]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[fa7]]></category>
		<category><![CDATA[Rafael Carneiro]]></category>
		<category><![CDATA[Reggie Hutcherson]]></category>
		<category><![CDATA[Simon Ritter]]></category>
		<category><![CDATA[Sun]]></category>
		<category><![CDATA[Sun Microsystems]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/15/more-photos-from-reggie-and-simon-in-fortaleza/</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/02/15/more-photos-from-reggie-and-simon-in-fortaleza/" title="More photos from Reggie and Simon in Fortaleza"></a>As I promised before, more pictures from Reggie Hutcherson (manager of the Sun Technology Evangelism group) and Simon Ritter (Java Technology Evangelist at Sun Microsystems) here in Fortaleza. The talk was a success and with a large audience, more than &#8230;<p class="read-more"><a href="http://silveiraneto.net/2008/02/15/more-photos-from-reggie-and-simon-in-fortaleza/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/02/15/more-photos-from-reggie-and-simon-in-fortaleza/" title="More photos from Reggie and Simon in Fortaleza"></a><p>As I <a href="http://silveiraneto.net/2008/02/13/reggie-and-simon-here-in-fortaleza/">promised before</a>,  more pictures from Reggie Hutcherson (manager of the Sun Technology Evangelism group) and Simon Ritter (Java Technology Evangelist at Sun Microsystems) here in Fortaleza.</p>
<p><a href="http://www.cejug.org/display/cejug/Cafe+com+Tapioca+com+Coco">The talk</a> was a success and with a large audience, <strong>more than 500 people</strong>!</p>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/a6jt16I2q7c&#038;rel=1&#038;border=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/a6jt16I2q7c&#038;rel=1&#038;border=0" type="application/x-shockwave-flash" wmode="transparent"width="425" height="355"></embed></object></center></p>
<p>Here some pictures I selected.</p>
<p><center><img src='http://silveiraneto.net/wp-content/uploads/2008/02/screenshot1.png' alt='cct' /></center></p>
<p><center><img src='http://silveiraneto.net/wp-content/uploads/2008/02/screenshot2.png' alt='cct' /></center></p>
<p><center><img src='http://silveiraneto.net/wp-content/uploads/2008/02/screenshot3.png' alt='cct' /></center></p>
<p><center><img src='http://silveiraneto.net/wp-content/uploads/2008/02/screenshot11.png' alt='More crowd' /></center></p>
<p>And you can see too all pictures in our <a href="http://picasaweb.google.com/cafecomtapioca/CafComTapiocaDeCoco">jug album</a> or here:</p>
<div style="background:#000;max-width:511px;margin:0 auto;text-align:center;line-height:0">
<div style="width:100%;height:341px;padding:0;margin:0"><iframe style="width:100%;height:100%" src="http://picasaweb.google.com/cafecomtapioca/CafComTapiocaDeCoco/photo#s5166578109334939650" frameBorder=0 scrolling=no></iframe></div>
<p><a href="http://blogger-templates.blogspot.com/2007/04/picasa-slideshow.html"><img style="border:none;padding:0;margin:0;float:left" src="http://btemplates.googlepages.com/add.gif" title="Add to my blog" alt="Picasa Slideshow" /></a><a href="http://picasaweb.google.com"><img style="border:none;padding:0;margin:0;float:right" src="http://btemplates.googlepages.com/picasa.png" title="Go to Picasa Web Albums" alt="Picasa Web Albums" /></a><a href="http://picasaweb.google.com/cafecomtapioca/CafComTapiocaDeCoco/photo#s5166578109334939650" onclick="window.open(this.href,'Slideshow','type=fullWindow,fullscreen,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,status=no');return false"><img style="border:none;padding:0;margin:0" src="http://btemplates.googlepages.com/fullscreen.gif" title="See in fullscreen [Press F11]" alt="Fullscreen" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/15/more-photos-from-reggie-and-simon-in-fortaleza/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reggie and Simon here in Fortaleza</title>
		<link>http://silveiraneto.net/2008/02/13/reggie-and-simon-here-in-fortaleza/</link>
		<comments>http://silveiraneto.net/2008/02/13/reggie-and-simon-here-in-fortaleza/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 15:27:36 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[airport]]></category>
		<category><![CDATA[CEJUG]]></category>
		<category><![CDATA[en]]></category>
		<category><![CDATA[Rafael Carneiro]]></category>
		<category><![CDATA[Reggie Hutcherson]]></category>
		<category><![CDATA[Simon Ritter]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/13/reggie-and-simon-here-in-fortaleza/</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/02/13/reggie-and-simon-here-in-fortaleza/" title="Reggie and Simon here in Fortaleza"></a>Reginald (Reggie) Hutcherson is the manager of the Sun Technology Evangelism group. Simon Ritter is a Java Technology Evangelist at Sun Microsystems. They were here in Brazil to some events and we bring them to Fortaleza (Ceará) to talk too &#8230;<p class="read-more"><a href="http://silveiraneto.net/2008/02/13/reggie-and-simon-here-in-fortaleza/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/02/13/reggie-and-simon-here-in-fortaleza/" title="Reggie and Simon here in Fortaleza"></a><p>Reginald (Reggie) Hutcherson is the manager of the Sun Technology Evangelism group. Simon Ritter is a Java Technology Evangelist at Sun Microsystems. They were here in Brazil to some events and we bring them to Fortaleza (Ceará) to talk too in our local jug event (<a href="http://www.cejug.org/display/cejug/Cafe+com+Tapioca+com+Coco" title="CCT">Café com Tapioca de Coco</a>).</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/plaquinha.JPG" alt="Plaquinha" /><br />
<small>Sign we made to find them in the airport.</small></p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/reggie_and_simon_in_the_airport.jpg" alt="Airport" /></p>
<p>Me and Rafael got them in the airport and showed some some cool places in the city. They already knew what they wanted to eat: barbecue!</p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/churrasco_simon_ritter.JPG" alt="Simon Ritter" /></p>
<p style="text-align: center"><img src="http://silveiraneto.net/wp-content/uploads/2008/02/silveira_rafael_reggie_and_simon.JPG" alt="Reggie and Simon" /><br />
<small>Reggie, me, Rafael and Simon.</small></p>
<p>They are really cool guys. Soon I&#8217;ll put some photos of event itself.</p>
<p>Unfortunately I could not stay for the event due my flight to São Paulo in order to be in the <a href="http://www.campus-party.com.br/">Campus Party Brasil 2008</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/13/reggie-and-simon-here-in-fortaleza/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>JavaFX Wheel of Fortune</title>
		<link>http://silveiraneto.net/2008/02/09/javafx-wheel-of-fortune/</link>
		<comments>http://silveiraneto.net/2008/02/09/javafx-wheel-of-fortune/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 00:38:29 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[fortune wheel]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfxbest]]></category>
		<category><![CDATA[roda da fortuna]]></category>
		<category><![CDATA[wheel of fortune]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/09/javafx-wheel-of-fortune/</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/02/09/javafx-wheel-of-fortune/" title="JavaFX Wheel of Fortune"></a>Disclaimer: from now on I will occasionally post in English too. A first release of an Wheel of Fortune made with JavaFX. There&#8217;s still has a lot of bugs but is already usable. Let&#8217;s say that version is 0.8. :) &#8230;<p class="read-more"><a href="http://silveiraneto.net/2008/02/09/javafx-wheel-of-fortune/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/02/09/javafx-wheel-of-fortune/" title="JavaFX Wheel of Fortune"></a><p><small><strong>Disclaimer:</strong> from now on I will occasionally post in English too.</small></p>
<p>A first release of an <em>Wheel of Fortune </em> made with <a href="http://www.sun.com/software/javafx/index.jsp">JavaFX</a>. There&#8217;s still has a lot of bugs but is already usable. Let&#8217;s say that version is 0.8. :)</p>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/_wnk666SRF4&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/_wnk666SRF4&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></center></p>
<p><span id="more-651"></span></p>
<pre name="code" class="java">
import javafx.ui.*;
import javafx.ui.canvas.*;
import javafx.ui.filter.*;

import java.util.Random;
import java.lang.System;

class Wheel extends CompositeNode{
    attribute n: Integer;
    attribute radius: Integer;
    attribute cx: Integer;
    attribute cy: Integer;
    attribute colors: Color*;

    private attribute angle: Number;
    private attribute rotAngle: Number;
    private attribute extraTurns: Integer;

    operation run();
}

attribute Wheel.n = 32;
attribute Wheel.radius = 100;
attribute Wheel.cx = radius;
attribute Wheel.cy = radius;
attribute Wheel.rotAngle = 0;
attribute Wheel.angle = bind 360/n;
attribute Wheel.extraTurns = 2;
attribute Wheel.colors = [
    red:Color,
    lime:Color,
    blue:Color,
    yellow:Color,
    orange:Color,
    cyan:Color
];

function Wheel.composeNode(){
    var selector = Rect {
        x: radius*2 - 10
        y: radius
        width: 30
        height: 10
        fill:black
    };

    var disc = foreach(j in [1..n]) Arc{
        transform: translate(-radius, -radius)
        width: radius * 2
        height: radius * 2
        startAngle: j*angle
        length: angle
        fill:colors[j%(sizeof colors)]
        closure: PIE
    };

    var border = Circle{
        radius:radius
        stroke:gray
        strokeWidth: 2
    };

    var glass = Circle{
        radius:radius - 25
        fill: white
        opacity: 0.3
    };

    var star = Star {
        rin: radius/4
        rout: radius/2
        points: 5

        startAngle: 18
        fill: yellow
    };

    var numbers = foreach(i in [1..n]) Text {
        transform: [rotate(i*angle, 0, 0), translate(radius - 20,0)]
        content: i.toString()
    };

    var base = Group{
        transform: bind [rotate(rotAngle,cx,cy),translate(cx,cy),]
        content: [disc, border, glass, numbers, star]
    };

    return Group {
        content: [selector, base]
    };
}

operation Wheel.run() {
    var fortune = new Random(System.currentTimeMillis());
    var chosen = fortune.nextInt(n);
    System.out.println(chosen);
    rotAngle = [1.. extraTurns*360+ chosen*angle] dur 200 * n;
}

var wheel = Wheel{};

Frame{
    visible: true
    content: Canvas {
        content: [
            wheel,
            View {
                content:Button {
                    text: "Go"
                    action: operation() {
                        wheel.run();
                    }
                }
            }
        ]
    }
}
</pre>
<p>The JavaFX Wheel of Fortune in use:<br />
<center><img src='http://farm4.static.flickr.com/3119/2342580970_cebc832144.jpg' alt='Fortune Wheel'/></center></p>
<ul>
<li><strong>ps:</strong> this code was actualized. Now it&#8217;s using colors constants and time as random seed.</li>
<li><strong>ps2:</strong> this code and video has figured out in the front page of the <a href="https://openjfx.dev.java.net/">Project OpenJFX</a>! Thank you guys.</li>
<li><strong>ps3: </strong> In 03/15/2008 I modified this code. Now you can put an arbitrary number for Wheel.n and the wheel should render good.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/09/javafx-wheel-of-fortune/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

