<?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; jfxbest</title>
	<atom:link href="http://silveiraneto.net/tag/jfxbest/feed/" rel="self" type="application/rss+xml" />
	<link>http://silveiraneto.net</link>
	<description>come with me, on the way I&#039;ll explain.</description>
	<lastBuildDate>Thu, 18 Mar 2010 03:00:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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[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 continue if true;
&#160;
var mountains = Clip&#123;
    transform: bind translate&#40;-scroll,0&#41;
    shape: Rect &#123;x:bind scroll, y:0, width:400, [...]]]></description>
			<content:encoded><![CDATA[<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 java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.canvas.*</span>;
&nbsp;
var scroll;
scroll <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>1..800<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>;
&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,0<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>0, 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>0,0<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>,0<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>;
&nbsp;
var h <span style="color: #339933;">=</span> <span style="color: #cc66cc;">50</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>0,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: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</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>JavaFX: Color picker</title>
		<link>http://silveiraneto.net/2008/02/19/javafx-color-picker/</link>
		<comments>http://silveiraneto.net/2008/02/19/javafx-color-picker/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 01:56:01 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[color picker]]></category>
		<category><![CDATA[colors]]></category>
		<category><![CDATA[draggable]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfx]]></category>
		<category><![CDATA[jfxbest]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[openjfx]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[vídeo]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/19/javafx-color-picker/</guid>
		<description><![CDATA[An simple color picker that can be also used as a gadget.


import javafx.ui.*;
import javafx.ui.canvas.*;

var colors = [red:Color, orange:Color, yellow:Color, green:Color,
     cyan:Color,blue:Color, magenta:Color, gray:Color];

var chosenColor: Paint;
chosenColor = black:Color;

var x = 120;
var y = 70;

Canvas{
    content: Group{
        transform: bind translate(x,y)
    [...]]]></description>
			<content:encoded><![CDATA[<p>An simple color picker that can be also used as a gadget.</p>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/nlldqniJiDg&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/nlldqniJiDg&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></center></p>
<pre name="code" class="JAVA">
import javafx.ui.*;
import javafx.ui.canvas.*;

var colors = [red:Color, orange:Color, yellow:Color, green:Color,
     cyan:Color,blue:Color, magenta:Color, gray:Color];

var chosenColor: Paint;
chosenColor = black:Color;

var x = 120;
var y = 70;

Canvas{
    content: Group{
        transform: bind translate(x,y)
        content: [Star{
            points: sizeof colors
            rin: 30
            rout: 50
            fill: bind chosenColor
            onMouseDragged: operation(e) {
                x += e.localDragTranslation.x;
                y += e.localDragTranslation.y;
            }
        },
        foreach (i in [1..sizeof colors]) Circle {
            var: self
            transform: [rotate(i*360/sizeof colors,0,0), translate(50,0)]
            radius: 10
            fill: colors[i%sizeof colors]
            onMouseClicked: operation (e){
                chosenColor = self.fill;
            }
        }]
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/19/javafx-color-picker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Draggable and Growable Ball in JavaFX</title>
		<link>http://silveiraneto.net/2008/02/16/draggable-and-growable-ball-in-javafx/</link>
		<comments>http://silveiraneto.net/2008/02/16/draggable-and-growable-ball-in-javafx/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 00:41:52 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ball]]></category>
		<category><![CDATA[código]]></category>
		<category><![CDATA[draggable]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[growable]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfx]]></category>
		<category><![CDATA[jfxbest]]></category>
		<category><![CDATA[openjfx]]></category>
		<category><![CDATA[Programação]]></category>
		<category><![CDATA[red ball]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[vídeo]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/16/draggable-and-growable-ball-in-javafx/</guid>
		<description><![CDATA[Two simple JavaFX code handling onMouseDragged event.


import javafx.ui.*;
import javafx.ui.canvas.*;

Canvas {
    content: Circle {
        var x = 50
        var y = 50
        transform: bind translate(x, y)
       [...]]]></description>
			<content:encoded><![CDATA[<p>Two simple JavaFX code handling onMouseDragged event.</p>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/M6G_N80UvZg&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/M6G_N80UvZg&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></center></p>
<pre name="code" class="JAVA">
import javafx.ui.*;
import javafx.ui.canvas.*;

Canvas {
    content: Circle {
        var x = 50
        var y = 50
        transform: bind translate(x, y)
        radius: 30
        fill: red
        onMouseDragged: operation(e) {
                x += e.localDragTranslation.x;
                y += e.localDragTranslation.y;

        }
    }
}
</pre>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/XvMGQomAcnc&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/XvMGQomAcnc&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></center></p>
<pre name="code" class="JAVA">
import javafx.ui.*;
import javafx.ui.canvas.*;

Canvas {
    content: Circle {
        var x = 50
        var y = 50
        var radius = 30
        transform: bind translate(x, y)
        radius: bind radius
        fill: red
        onMouseDragged: operation(e) {
            if (e.button == 1){
                x += e.localDragTranslation.x;
                y += e.localDragTranslation.y;
            }
            if (e.button == 3) {
                radius += e.localDragTranslation.x;
            }
        }
    }
}
</pre>
<p><center><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/VOdjY8lR51Y&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/VOdjY8lR51Y&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></center></p>
<pre name="code" class="JAVA">
import javafx.ui.*;
import javafx.ui.canvas.*;

Canvas {
    content: [
    Rect {x: 50, y: 50, width: 50, height: 50, fill: orange },
    Circle {
        var x = 50
        var y = 50
        var radius = 30
        var color = red:Color
        transform: bind translate(x, y)
        radius: bind radius
        fill: bind color
        onMouseDragged: operation(e) {
            if (e.button == 1){
                x += e.localDragTranslation.x;
                y += e.localDragTranslation.y;
            }
            if (e.button == 3) {
                radius += e.localDragTranslation.x;
            }
        }
        onMousePressed: operation(e){
            color = Color {blue: 0.0, green: 0.0, red: 1.0, opacity: 0.5};
        }
        onMouseReleased: operation(e){
            color = red:Color;
        }
    }]
}
</pre>
<p>You can test this examples with thhe <a href="http://download.java.net/general/openjfx/demos/javafxpad.jnlp">JavaFX Pad</a> or using Netbeans with the <a href="http://javafx.netbeans.org/">JavaFX Plugin</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/16/draggable-and-growable-ball-in-javafx/feed/</wfw:commentRss>
		<slash:comments>2</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[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.  



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;
 [...]]]></description>
			<content:encoded><![CDATA[<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. <img src='http://silveiraneto.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </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>
		<item>
		<title>Gato em JavaFX, versão 2</title>
		<link>http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/</link>
		<comments>http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 22:13:10 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[animação]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[gato]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfxbest]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[vídeo]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/</guid>
		<description><![CDATA[Lembra daquele nosso gato em Java FX? Agora ele move os olhos com cliques em botões.



Código fonte:


import javafx.ui.canvas.*;
import javafx.ui.*;
&#160;
class Cat extends CompositeNode&#123;
    attribute look: Number; // -1.0 to 1.0
    operation lookLeft&#40;&#41;;
    operation lookCenter&#40;&#41;;
    operation lookRight&#40;&#41;;
&#125;
&#160;
attribute Cat.look = 0; // 0 = middle
&#160;
operation Cat.lookLeft&#40;&#41;&#123;
 [...]]]></description>
			<content:encoded><![CDATA[<p>Lembra <a href="http://silveiraneto.net/2008/01/30/gato-em-javafx/">daquele nosso gato</a> em Java FX? Agora ele move os olhos com cliques em botões.<br />
<center><br />
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/7FQzTkZK-gI&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/7FQzTkZK-gI&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object><br />
</center></p>
<p><strong>Código fonte:</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.canvas.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.*</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Cat <span style="color: #000000; font-weight: bold;">extends</span> CompositeNode<span style="color: #009900;">&#123;</span>
    attribute look<span style="color: #339933;">:</span> <span style="color: #003399;">Number</span>; <span style="color: #666666; font-style: italic;">// -1.0 to 1.0</span>
    operation lookLeft<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    operation lookCenter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    operation lookRight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
attribute Cat.<span style="color: #006633;">look</span> <span style="color: #339933;">=</span> 0; <span style="color: #666666; font-style: italic;">// 0 = middle</span>
&nbsp;
operation Cat.<span style="color: #006633;">lookLeft</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    look <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>look, look <span style="color: #339933;">-</span> <span style="color: #cc66cc;">0.1</span> .. <span style="color: #339933;">-</span><span style="color: #cc66cc;">1.0</span><span style="color: #009900;">&#93;</span> dur <span style="color: #cc66cc;">1000</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
operation Cat.<span style="color: #006633;">lookCenter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    var step <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">if</span> look <span style="color: #339933;">&lt;</span> 0 then <span style="color: #cc66cc;">0.1</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">0.1</span>;
    look <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>look, look<span style="color: #339933;">+</span>step .. <span style="color: #cc66cc;">0.0</span><span style="color: #009900;">&#93;</span> dur <span style="color: #cc66cc;">1000</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
operation Cat.<span style="color: #006633;">lookRight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    look <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>look, look <span style="color: #339933;">+</span> <span style="color: #cc66cc;">0.1</span> .. <span style="color: #cc66cc;">1.0</span><span style="color: #009900;">&#93;</span> dur <span style="color: #cc66cc;">1000</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
function Cat.<span style="color: #006633;">composeNode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    var head <span style="color: #339933;">=</span>  Ellipse <span style="color: #009900;">&#123;</span>cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">50</span>, fill<span style="color: #339933;">:</span>black <span style="color: #009900;">&#125;</span>;
    var rightEar <span style="color: #339933;">=</span>  Arc <span style="color: #009900;">&#123;</span>x<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">10</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">150</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
                       startAngle<span style="color: #339933;">:-</span><span style="color: #cc66cc;">20</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span>;
    var leftEar <span style="color: #339933;">=</span> Arc <span style="color: #009900;">&#123;</span>x<span style="color: #339933;">:</span>000, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">10</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">150</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
                     startAngle<span style="color: #339933;">:</span><span style="color: #cc66cc;">110</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span>;
    var leftEye <span style="color: #339933;">=</span> Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">60</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span>;
    var rightEye <span style="color: #339933;">=</span> Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">140</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span>;
    var nose <span style="color: #339933;">=</span> Arc <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span><span style="color: #cc66cc;">85</span>, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">110</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">20</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>,
                     startAngle<span style="color: #339933;">:</span><span style="color: #cc66cc;">45</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span>;
&nbsp;
    var rightIris <span style="color: #339933;">=</span> Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span> bind <span style="color: #cc66cc;">140</span><span style="color: #339933;">+</span>look<span style="color: #339933;">*</span><span style="color: #cc66cc;">20</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
                     radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span>;
    var leftIris <span style="color: #339933;">=</span> Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span> bind <span style="color: #cc66cc;">60</span><span style="color: #339933;">+</span>look<span style="color: #339933;">*</span><span style="color: #cc66cc;">20</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
                     radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">Group</span><span style="color: #009900;">&#123;</span>content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>head, rightEar, leftEar, leftEye,
                     leftIris, rightEye, rightIris, nose<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
var myCat <span style="color: #339933;">=</span> Cat<span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>;
&nbsp;
var myCatControl <span style="color: #339933;">=</span> <span style="color: #003399;">View</span> <span style="color: #009900;">&#123;</span>
            transform<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>translate<span style="color: #009900;">&#40;</span>0, <span style="color: #cc66cc;">150</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span>
            content<span style="color: #339933;">:</span> GroupPanel <span style="color: #009900;">&#123;</span>
                cursor<span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">DEFAULT</span>
                var row <span style="color: #339933;">=</span> Row <span style="color: #009900;">&#123;</span>alignment<span style="color: #339933;">:</span> BASELINE<span style="color: #009900;">&#125;</span>
                var column1 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                var column2 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                var column3 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                var column4 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                var column5 <span style="color: #339933;">=</span> Column <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
                rows<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>row<span style="color: #009900;">&#93;</span>
                columns<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>column1, column2, column3, column4<span style="color: #009900;">&#93;</span>
                content<span style="color: #339933;">:</span>
                <span style="color: #009900;">&#91;</span>SimpleLabel <span style="color: #009900;">&#123;</span>
                    row<span style="color: #339933;">:</span> row
                    column<span style="color: #339933;">:</span> column1
                    text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Look:&quot;</span>
                <span style="color: #009900;">&#125;</span>,
                <span style="color: #003399;">Button</span> <span style="color: #009900;">&#123;</span>
                    row<span style="color: #339933;">:</span> row
                    column<span style="color: #339933;">:</span> column2
                    mnemonic<span style="color: #339933;">:</span> L
                    text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Left&quot;</span>
                    action<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        myCat.<span style="color: #006633;">lookLeft</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>,
                <span style="color: #003399;">Button</span> <span style="color: #009900;">&#123;</span>
                    row<span style="color: #339933;">:</span> row
                    column<span style="color: #339933;">:</span> column3
                    mnemonic<span style="color: #339933;">:</span> C
                    text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Center&quot;</span>
                    action<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        myCat.<span style="color: #006633;">lookCenter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>,
                <span style="color: #003399;">Button</span> <span style="color: #009900;">&#123;</span>
                    row<span style="color: #339933;">:</span> row
                    column<span style="color: #339933;">:</span> column4
                    mnemonic<span style="color: #339933;">:</span> R
                    text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Right&quot;</span>
                    action<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        myCat.<span style="color: #006633;">lookRight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>;
&nbsp;
<span style="color: #003399;">Canvas</span> <span style="color: #009900;">&#123;</span>
    content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>myCatControl, myCat<span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>Downloads:</p>
<ul>
<li>Código-fonte: <a href="http://silveiraneto.net/downloads/cat_ver2.fx">cat_ver2.fx</a></li>
<li>Vídeo: <a href="http://silveiraneto.net/downloads/moving_eyes_cat.ogg">moving_eyes_cat.ogg</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/06/gato-em-javafx-versao-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JavaFX, Exemplos Básicos</title>
		<link>http://silveiraneto.net/2008/02/06/javafx-exemplos-basicos/</link>
		<comments>http://silveiraneto.net/2008/02/06/javafx-exemplos-basicos/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 16:29:46 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfxbest]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/02/06/javafx-exemplos-basicos/</guid>
		<description><![CDATA[Alguns exemplo básicos de JavaFX usando a construção de interfaces de forma declarativa.
Para testa-los eu recomendo o JavaFX Pad ou o plugin JavaFX para Netbeans.


import javafx.ui.*;
&#160;
Frame &#123;
    title: &#34;Label JavaFX&#34;
    width:  300
    height: 50
    content: Label &#123;
      [...]]]></description>
			<content:encoded><![CDATA[<p>Alguns exemplo básicos de JavaFX usando a construção de interfaces de forma declarativa.<br />
Para testa-los eu recomendo o<a href="http://download.java.net/general/openjfx/demos/javafxpad.jnlp"> JavaFX Pad</a> ou o <a href="http://javafx.netbeans.org/">plugin JavaFX para Netbeans</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.ui.*</span>;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Label JavaFX&quot;</span>
    width<span style="color: #339933;">:</span>  <span style="color: #cc66cc;">300</span>
    height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">50</span>
    content<span style="color: #339933;">:</span> <span style="color: #003399;">Label</span> <span style="color: #009900;">&#123;</span>
            text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Olá Mundo!&quot;</span>
    <span style="color: #009900;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><img src="http://silveiraneto.net/wp-content/uploads/2008/02/javafx_olamundo.png" alt="JavaFX label" /></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.ui.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.System</span>;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Botão JavaFX&quot;</span>
    width<span style="color: #339933;">:</span>  <span style="color: #cc66cc;">300</span>
    height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>
    content<span style="color: #339933;">:</span> <span style="color: #003399;">Button</span> <span style="color: #009900;">&#123;</span>
           text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Clique-me&quot;</span>
           action<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
              <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Botão pressionado&quot;</span><span style="color: #009900;">&#41;</span>;
           <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><img src="http://silveiraneto.net/wp-content/uploads/2008/02/javafx_botao.png" alt="Botão em JavaFX" /></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.ui.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.System</span>;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
  title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Menu JavaFX&quot;</span>
  width<span style="color: #339933;">:</span>  <span style="color: #cc66cc;">300</span>
  height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>
  menubar<span style="color: #339933;">:</span> <span style="color: #003399;">MenuBar</span> <span style="color: #009900;">&#123;</span>
    menus<span style="color: #339933;">:</span> <span style="color: #003399;">Menu</span> <span style="color: #009900;">&#123;</span>
      text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Menu&quot;</span>
      items<span style="color: #339933;">:</span>  <span style="color: #000000; font-weight: bold;">foreach</span> <span style="color: #009900;">&#40;</span>name in <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Menu1&quot;</span>, <span style="color: #0000ff;">&quot;Menu2&quot;</span>, <span style="color: #0000ff;">&quot;Menu3&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
              <span style="color: #003399;">MenuItem</span> <span style="color: #009900;">&#123;</span>
                text<span style="color: #339933;">:</span> name
                action<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                  <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MenuItem: {name}&quot;</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;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><img src='http://silveiraneto.net/wp-content/uploads/2008/02/javafx_menu.png' alt='JavaFX Menu' /></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.ui.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.System</span>;
&nbsp;
var N <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span>;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Tabela JavaFX&quot;</span>
    width<span style="color: #339933;">:</span>  <span style="color: #cc66cc;">300</span>
    height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">150</span>
    onClose<span style="color: #339933;">:</span> operation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</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>
    content<span style="color: #339933;">:</span> Table <span style="color: #009900;">&#123;</span>
        columns<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        <span style="color: #003399;">TableColumn</span> <span style="color: #009900;">&#123;</span>
            text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;numero&quot;</span>
        <span style="color: #009900;">&#125;</span>,
        <span style="color: #003399;">TableColumn</span> <span style="color: #009900;">&#123;</span>
            text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;quadrado&quot;</span>
        <span style="color: #009900;">&#125;</span>,
        <span style="color: #003399;">TableColumn</span> <span style="color: #009900;">&#123;</span>
            text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;cubo&quot;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span>
&nbsp;
        cells<span style="color: #339933;">:</span> bind <span style="color: #000000; font-weight: bold;">foreach</span><span style="color: #009900;">&#40;</span>n 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><span style="color: #009900;">&#91;</span>
        TableCell <span style="color: #009900;">&#123;</span>
            text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;{n}&quot;</span>
        <span style="color: #009900;">&#125;</span>,
        TableCell <span style="color: #009900;">&#123;</span>
            text<span style="color: #339933;">:</span> bind <span style="color: #0000ff;">&quot;{n * n}&quot;</span>
        <span style="color: #009900;">&#125;</span>,
        TableCell <span style="color: #009900;">&#123;</span>
            text<span style="color: #339933;">:</span> bind <span style="color: #0000ff;">&quot;{n * n * n}&quot;</span>
        <span style="color: #009900;">&#125;</span>,
        <span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><img src='http://silveiraneto.net/wp-content/uploads/2008/02/javafx_tabela.png' alt='JavaFX Tabela' /></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.ui.*</span>;
&nbsp;
var selectedTab <span style="color: #339933;">=</span> 0;
&nbsp;
<span style="color: #003399;">Frame</span><span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Tab Example&quot;</span>
    width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">300</span>
    height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">120</span>
    content<span style="color: #339933;">:</span> BorderPanel<span style="color: #009900;">&#123;</span>
        top<span style="color: #339933;">:</span> <span style="color: #003399;">Label</span> <span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> bind <span style="color: #0000ff;">&quot;Selected tab: {selectedTab + 1}&quot;</span> <span style="color: #009900;">&#125;</span>
        center<span style="color: #339933;">:</span> TabbedPane<span style="color: #009900;">&#123;</span>
            selectedIndex<span style="color: #339933;">:</span> bind selectedTab
            tabs<span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">foreach</span><span style="color: #009900;">&#40;</span>i in <span style="color: #009900;">&#91;</span>1..5<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            Tab <span style="color: #009900;">&#123;</span>
                title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Tab{i}&quot;</span>
                content<span style="color: #339933;">:</span> <span style="color: #003399;">Label</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Label{i} &quot;</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>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><img src='http://silveiraneto.net/wp-content/uploads/2008/02/javafx_abas.png' alt='JavaFX abas' /></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.ui.*</span>;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;FlowPanel JavaFX&quot;</span>
    width<span style="color: #339933;">:</span>  <span style="color: #cc66cc;">300</span>
    height<span style="color: #339933;">:</span> <span style="color: #cc66cc;">100</span>
    content<span style="color: #339933;">:</span> FlowPanel<span style="color: #009900;">&#123;</span>
        content<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span>
        <span style="color: #003399;">Label</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Label1&quot;</span> <span style="color: #009900;">&#125;</span>,
        <span style="color: #003399;">Label</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Label2&quot;</span> <span style="color: #009900;">&#125;</span>,
        <span style="color: #003399;">Label</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Label3&quot;</span> <span style="color: #009900;">&#125;</span>,
        <span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><img src='http://silveiraneto.net/wp-content/uploads/2008/02/javafx_flowpanel.png' alt='JavaFX FlowPanel' /></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.ui.*</span>;
&nbsp;
<span style="color: #003399;">Frame</span> <span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;BorderPanel JavaFX&quot;</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>
    content<span style="color: #339933;">:</span> BorderPanel<span style="color: #009900;">&#123;</span>
        top   <span style="color: #339933;">:</span>  <span style="color: #003399;">Button</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Topo&quot;</span> <span style="color: #009900;">&#125;</span>
        center<span style="color: #339933;">:</span>  <span style="color: #003399;">Button</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Centro&quot;</span> <span style="color: #009900;">&#125;</span>
        bottom<span style="color: #339933;">:</span>  <span style="color: #003399;">Button</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Fundo&quot;</span> <span style="color: #009900;">&#125;</span>
        left  <span style="color: #339933;">:</span>  <span style="color: #003399;">Button</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Esquerda&quot;</span> <span style="color: #009900;">&#125;</span>
        right <span style="color: #339933;">:</span>  <span style="color: #003399;">Button</span><span style="color: #009900;">&#123;</span> text<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Direita&quot;</span> <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    visible<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><img src='http://silveiraneto.net/wp-content/uploads/2008/02/javafx_borderpanel.png' alt='JavaFX BorderPanel' /></p>
<p>Esses exemplos eu retirei da <a href="http://ru.jfx.wikia.com/wiki/JavaFX_API">página de exemplos do Wiki do JavaFX</a> (russo). Se você quiser saber mais sobre componentes de interface gráfica em JavaFX veja o tutorial<br />
<a href="https://openjfx.dev.java.net/Learning_More_About_JavaFX.html">Learning More About the JavaFX Script Language (for Swing Programmers)</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/02/06/javafx-exemplos-basicos/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Gato em JavaFX</title>
		<link>http://silveiraneto.net/2008/01/30/gato-em-javafx/</link>
		<comments>http://silveiraneto.net/2008/01/30/gato-em-javafx/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 20:05:41 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arte]]></category>
		<category><![CDATA[gato]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[jfxbest]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/2008/01/30/gato-em-javafx/</guid>
		<description><![CDATA[Meu primeiro desenho com JavaFX.

Código-fonte:


import javafx.ui.canvas.*;
import javafx.ui.*;
&#160;
Canvas &#123;
    content: &#91;
    // cat head
    Ellipse &#123; cx:200, cy:100, radiusX:100, radiusY:50, fill:black &#125;,
    // right ear
    Arc &#123; x:200, y:10, height:150, width:100,
        startAngle:-20, length:90, closure:PIE, [...]]]></description>
			<content:encoded><![CDATA[<p>Meu primeiro desenho com <a href="http://www.sun.com/software/javafx/index.jsp">JavaFX</a>.<br />
<center><img src='http://silveiraneto.net/wp-content/uploads/2008/01/gato_em_javafx.png' alt='Gato em JavaFX' /></center></p>
<p><strong>Código-fonte:</strong></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.ui.canvas.*</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javafx.ui.*</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>
    <span style="color: #666666; font-style: italic;">// cat head</span>
    Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">200</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">50</span>, fill<span style="color: #339933;">:</span>black <span style="color: #009900;">&#125;</span>,
    <span style="color: #666666; font-style: italic;">// right ear</span>
    Arc <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span><span style="color: #cc66cc;">200</span>, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">10</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">150</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
        startAngle<span style="color: #339933;">:-</span><span style="color: #cc66cc;">20</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span>,
    <span style="color: #666666; font-style: italic;">// left ear</span>
    Arc <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">10</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">150</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>,
        startAngle<span style="color: #339933;">:</span><span style="color: #cc66cc;">110</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span>,
    <span style="color: #666666; font-style: italic;">// left eye</span>
    Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">160</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span>,
    Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">160</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span>,
    <span style="color: #666666; font-style: italic;">// right eye</span>
    Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">240</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span>,
    Ellipse <span style="color: #009900;">&#123;</span> cx<span style="color: #339933;">:</span><span style="color: #cc66cc;">240</span>, cy<span style="color: #339933;">:</span><span style="color: #cc66cc;">100</span>, radiusX<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span>, radiusY<span style="color: #339933;">:</span><span style="color: #cc66cc;">15</span>, fill<span style="color: #339933;">:</span>black<span style="color: #009900;">&#125;</span>,
    <span style="color: #666666; font-style: italic;">// nose</span>
    Arc <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span><span style="color: #cc66cc;">185</span>, y<span style="color: #339933;">:</span><span style="color: #cc66cc;">110</span>, height<span style="color: #339933;">:</span><span style="color: #cc66cc;">20</span>, width<span style="color: #339933;">:</span><span style="color: #cc66cc;">30</span>,
        startAngle<span style="color: #339933;">:</span><span style="color: #cc66cc;">45</span>, length<span style="color: #339933;">:</span><span style="color: #cc66cc;">90</span>, closure<span style="color: #339933;">:</span>PIE, fill<span style="color: #339933;">:</span>white<span style="color: #009900;">&#125;</span>,
    <span style="color: #009900;">&#93;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>Sim, foi uma tentativa de reproduzir <a href="http://silveiraneto.net/2008/01/17/garota-com-uma-bazuca-e-um-gato-preto/">este outro gato</a>. <img src='http://silveiraneto.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/01/30/gato-em-javafx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
