<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2816671802411378241</id><updated>2011-07-07T21:35:36.557-07:00</updated><title type='text'>Programação</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://heitormoura.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2816671802411378241/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://heitormoura.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Heitor Gonzaga</name><uri>http://www.blogger.com/profile/17039548072918473723</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2816671802411378241.post-4482996211407717242</id><published>2009-12-22T03:53:00.000-08:00</published><updated>2009-12-22T05:20:14.784-08:00</updated><title type='text'>JavaFx com J2SE</title><content type='html'>Olá pessoal, estou aqui escrevendo o meu primeiro exemplo de JavaFx, vou mostrar para vocês como integrar javafx com classes do JSE.&lt;br /&gt;Como todos devem saber o JavaFx é a aposta da Sun para aplicações ricas para a internet ou simplismente RIA, o JavaFx é 100% compativel com o JSE&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Primeiramente vamos criar um projeto no Eclipse.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Vamos em File -&gt; New -&gt; Java Project&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class=" on" style="display: block;" id="formatbar_Add_Image" title="Adicionar imagem" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="addImage();" onmousedown="CheckFormatting(event);;ButtonMouseDown(this);"&gt;&lt;img src="http://www.blogger.com/img/blank.gif" alt="Adicionar imagem" class="gl_photo" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_uGREh-e0f5Q/SzDABENnccI/AAAAAAAAAAk/OCe680EJnO8/s1600-h/tela01.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 276px;" src="http://2.bp.blogspot.com/_uGREh-e0f5Q/SzDABENnccI/AAAAAAAAAAk/OCe680EJnO8/s400/tela01.PNG" alt="" id="BLOGGER_PHOTO_ID_5418041476269961666" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_uGREh-e0f5Q/SzC_2_7p4ZI/AAAAAAAAAAc/maSLYbc9ggc/s1600-h/tela02.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 283px;" src="http://3.bp.blogspot.com/_uGREh-e0f5Q/SzC_2_7p4ZI/AAAAAAAAAAc/maSLYbc9ggc/s400/tela02.PNG" alt="" id="BLOGGER_PHOTO_ID_5418041303322190226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Daremos o nome do nosso projeto (no meu caso coloquei JavaFx) e clicaremos em Finish&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Criaremos um pacote chamodo exemplo (ou um outro nome da sua preferência - ) apenas para organizarmos melhor nossas classes.&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_uGREh-e0f5Q/SzDBxsz2u3I/AAAAAAAAAAs/_ZDVp5c6lZg/s1600-h/tela03.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 282px;" src="http://3.bp.blogspot.com/_uGREh-e0f5Q/SzDBxsz2u3I/AAAAAAAAAAs/_ZDVp5c6lZg/s400/tela03.PNG" alt="" id="BLOGGER_PHOTO_ID_5418043411313113970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Defina o nome e click em Finish.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Crie agora uma nova classe Java (Botão direito em cima do pacote que acabou de criar vá em New -&gt; Class -&gt;Informe o Nome para a Classe {"Nesse Exemplo coloquei &lt;span style="color: rgb(102, 0, 0);"&gt;Animal&lt;/span&gt;"} e clique em Finish).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol style="color: rgb(153, 0, 0);"&gt;&lt;li&gt;package exemplo;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;public class Animal {&lt;/li&gt;&lt;li&gt;    &lt;br /&gt;&lt;/li&gt;&lt;li&gt;       private String raca;&lt;/li&gt;&lt;li&gt;   &lt;br /&gt;&lt;/li&gt;&lt;li&gt;       public void setRaca(String raca)&lt;/li&gt;&lt;li&gt;       {&lt;/li&gt;&lt;li&gt;            this.raca = raca;        &lt;/li&gt;&lt;li&gt;            javax.swing.JOptionPane.showMessageDialog(null,this.raca,&lt;/li&gt;&lt;li&gt;                "JavaFx",javax.swing.JOptionPane.INFORMATION_MESSAGE);&lt;/li&gt;&lt;li&gt;        }&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;        public String getRaca()&lt;/li&gt;&lt;li&gt;        {&lt;/li&gt;&lt;li&gt;             return this.raca;&lt;/li&gt;&lt;li&gt;        }&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Agora vamos ao código JavaFx que fará uso da nossa classe.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Para criar uma classe JavaFx proceda da seguinte maneira: &lt;span style="color: rgb(102, 0, 0);"&gt;Botão direito em cima do pacote que você criou vá em New -&gt; Other -&gt; JavaFx -&gt; Empty JavaFx Script -&gt; Informe um Nome ("Nesse exemplo coloquei Prg01") e clique em Finish.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol style="color: rgb(153, 0, 0);"&gt;&lt;li&gt;package exemplo;&lt;/li&gt;&lt;li&gt;import javafx.stage.Stage;&lt;/li&gt;&lt;li&gt;import javafx.scene.Scene;&lt;/li&gt;&lt;li&gt;import javafx.scene.control.Button;&lt;/li&gt;&lt;li&gt;import javafx.scene.control.TextBox;&lt;/li&gt;&lt;li&gt;import javafx.scene.Cursor;&lt;/li&gt;&lt;li&gt;import javafx.scene.effect.*;&lt;/li&gt;&lt;li&gt;import  javafx.scene.effect.Reflection;&lt;/li&gt;&lt;li&gt;//Cria o Objeto Animal&lt;/li&gt;&lt;li&gt;var a = Animal{};&lt;/li&gt;&lt;li&gt;//Cria o Botão&lt;/li&gt;&lt;li&gt;var btn = Button&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;   &lt;br /&gt;&lt;/li&gt;&lt;li&gt;    text: "Chamar Classe";&lt;/li&gt;&lt;li&gt;    layoutX:370;&lt;/li&gt;&lt;li&gt;    layoutY:200;&lt;/li&gt;&lt;li&gt;    cursor:Cursor.HAND;&lt;/li&gt;&lt;li&gt;   &lt;br /&gt;&lt;/li&gt;&lt;li&gt;    //Cria o evento action&lt;/li&gt;&lt;li&gt;    action: function()&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;       //Faz uso do objeto animal passando como parâmetro a String contida no&lt;br /&gt;&lt;/li&gt;&lt;li&gt;       //TextBox&lt;br /&gt;&lt;/li&gt;&lt;li&gt;        a.setRaca(txt.text);                                &lt;/li&gt;&lt;li&gt;    }                        &lt;/li&gt;&lt;li&gt;   &lt;br /&gt;&lt;/li&gt;&lt;li&gt;    //Faz uso do efeito Reflection que faz um espelhamento&lt;/li&gt;&lt;li&gt;    effect: Reflection&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;        fraction:1.0;&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;//Cria o TextBox&lt;/li&gt;&lt;li&gt;var txt = TextBox&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;    //Define tamanho máximo do campo para 30 caracteres&lt;/li&gt;&lt;li&gt;    columns:30;&lt;/li&gt;&lt;li&gt;    //Posição no eixo X (referencia na tela)&lt;/li&gt;&lt;li&gt;    layoutX: 100;&lt;/li&gt;&lt;li&gt;    //Posição no eixo Y (referencia na tela)&lt;/li&gt;&lt;li&gt;    layoutY: 200;    &lt;/li&gt;&lt;li&gt;   &lt;br /&gt;&lt;/li&gt;&lt;li&gt;    cursor:Cursor.HAND;&lt;/li&gt;&lt;li&gt;   &lt;br /&gt;&lt;/li&gt;&lt;li&gt;    //Faz uso do efeito Reflection que faz um espelhamento&lt;/li&gt;&lt;li&gt;    effect: Reflection&lt;/li&gt;&lt;li&gt;    {&lt;/li&gt;&lt;li&gt;        fraction:1.0;&lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;Stage&lt;/li&gt;&lt;li&gt;{&lt;/li&gt;&lt;li&gt;    //Define o Titulo do Stage&lt;/li&gt;&lt;li&gt;    title:"JavaFx Programmer";    &lt;/li&gt;&lt;li&gt;   &lt;br /&gt;&lt;/li&gt;&lt;li&gt;    //Cria uma Scene para o stage e define os objetos nela&lt;/li&gt;&lt;li&gt;    scene: Scene&lt;/li&gt;&lt;li&gt;    {        &lt;/li&gt;&lt;li&gt;        height:500;&lt;/li&gt;&lt;li&gt;        width:500;&lt;/li&gt;&lt;li&gt;        content: [            &lt;/li&gt;&lt;li&gt;            btn, txt&lt;/li&gt;&lt;li&gt;        ]         &lt;/li&gt;&lt;li&gt;    }&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;Como resultado temos a seguinte tela.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_uGREh-e0f5Q/SzDHKzWGvSI/AAAAAAAAAA0/t30tz1B9kJo/s1600-h/tela04.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 374px;" src="http://4.bp.blogspot.com/_uGREh-e0f5Q/SzDHKzWGvSI/AAAAAAAAAA0/t30tz1B9kJo/s400/tela04.PNG" alt="" id="BLOGGER_PHOTO_ID_5418049340122250530" border="0" /&gt;&lt;/a&gt;Pessoal espero que tenham gostado, e até a proxima.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2816671802411378241-4482996211407717242?l=heitormoura.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://heitormoura.blogspot.com/feeds/4482996211407717242/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://heitormoura.blogspot.com/2009/12/javafx-com-j2se.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2816671802411378241/posts/default/4482996211407717242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2816671802411378241/posts/default/4482996211407717242'/><link rel='alternate' type='text/html' href='http://heitormoura.blogspot.com/2009/12/javafx-com-j2se.html' title='JavaFx com J2SE'/><author><name>Heitor Gonzaga</name><uri>http://www.blogger.com/profile/17039548072918473723</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_uGREh-e0f5Q/SzDABENnccI/AAAAAAAAAAk/OCe680EJnO8/s72-c/tela01.PNG' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
