Home Sign up! Who is Mr.Bool? Channels Courses Publish your post Login Contact us RSS Mr.Bool Credits Buy Credits
 
 
Outras seções:
Home 
Entenda o site 
Revistas 
Canais 
Cursos 
Palestras 
Suporte 
Fórum 
Oportunidades 
 Todos os links 

 
  Ir para o Canal DevMedia  
+Canais:
Canal Delphi 
Canal Java 
Canal .net 
Canal Banco de dados 
Canal Mobile 
Canal Ruby on Rails 
Canal PHP 
Canal ASP 
Canal WebDesign 
Canal Engenharia de Software 
Canal Linux 
Canal Scripting 
Canal Outros 
  Todo conteúdo DevMedia 

 
  ver cursos de DevMedia  
+Cursos:
Cursos de Java 
Cursos de .net 
Cursos de Banco de dados 
Cursos de Delphi 
Cursos de Engenharia de Software 
Cursos de Ruby on Rails 
Cursos de ASP 
Cursos de WebDesign 
Cursos de PHP 
Cursos de PalmOS 
Cursos de Linux 
Cursos de Scripting 
  Formações completas 
  Todos os cursos 

 
Canal de conteúdo DevMedia
Palestras de DevMedia
E-books de DevMedia
Downloads de DevMedia
 

+Revistas:
ClubeDelphi 
.net Magazine 
Java Magazine 
webMobile Magazine 
SQL Magazine 
Engenharia de Software Magazine 
  Edições anteriores impressas 
  Todas as revistas 


[Close]
This post can be viewed only by users that have MrBool Credits.


  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits: in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits


Eclipse JavaFX Plug-in Quick Start Tutorial

Eclipse JavaFX Plug-in Quick Start Tutorial


This tutorial is a quick start guide for the Eclipse JavaFX plug-in.  To kick things off, we start with some background on JavaFX.  If you're anxious to get started, hop down to the "Eclipse JavaFX Plug-in" section. 

1. Introducing JavaFX

Sun's announcement of JavaFX at this year's JavaOne Conference grabbed the attention of many Java developers.  JavaFX is a Sun product family comprised of JavaFX Script and JavaFX Mobile.  JavaFX Script is a language for creating rich media and interactive content and is a GPL'ed open source project.  Java Mobile is Sun's software system for mobile device and uses industry standard API and technologies which can be leveraged across various mobile devices. 

JavaFX Script is designed to compete with Adobe Flex and Microsoft Silverlight which are Rich Internet Application (RIA) development tools.  Abobe's Flash technology has become the standard for streaming video delivery over the web (have you ever used YouTube?).  Flex builds on Flash and is designed for creating and delivering RIA.  Silverlight is Microsoft's ActiveX based offering in the same space.  There is intense competition in the RIA space right now as even Firefox is jumping in and there are also open source offerings such as OpenLaszlo.


The main competition for all of these new RIA tools is Ajax.  Ajax has set a standard high for web applications as users have become accustomed to responsive web applications.  Ajax development is not easy, but there are many frameworks for Ajax that are making life easier for developers (see our review of popular Ajax Frameworks).  Ajax differs from RIA tools in that a browser plug-in is not required.


RIA architecture depends on a client side engine (i.e., a browser plug-in) to handle execution.  The plug-in provides cross browser support and assumes the low-level heavy lifting of rendering the application's user interface and communicating with the server.  The application developer benefits by writing code once in a high level language for deployment to a wide range of client platforms.


Sun's prior offering in this area was Swing delivered over Webstart/JNLP.  This tool chain's downside is a large download size and Swing's complex development model.  JavaFX is intended to address these shortcomings.


Should you drop your current development methodology and implement you next production application with JavaFX?  The current answer is a definite no!  JavaFX development is in the early stage.  The JavaFX announcement is for the alpha release.  The tool-chain is lacking several important pieces such as a graphical GUI builder and the deployment model is not yet clear.  A more reasonable approach is to keep tabs on JavaFX and be ready to adopt it when the technology matures.  With this in mind, we've prepared this tutorial which illustrates getting started with JavaFX and the Eclipse plug-in.

2. Eclipse JavaFX Plug-in 

There is a good tutorial for using the JavaFX plug-in for NetBeans to create a Hello World JavaFX program posted at OpenJFX.  OpenJFX also provides a JavaFX plug-in for Eclipse.  Below we are going to show you how to use the Eclipse plug-in to write a JavaFX Hello World program.

First, On the OpenJFX website, you need to follow the download and installation instructions to install the Eclipse JavaFX plug-in.  As the instructions indicate, Eclipse 3.2.2 and JDK 5.0 are required.  However, JDK 6.0 seems to work fine for me.

Once the plug-in is installed, the first step is to create a Java Project.  This step is no different from creating a regular Java application project.  First, click "New"->"New Project" and select "Java Project":


Next, enter the project name "helloworld" and project location.  Make sure you select "JRE 5.0" for your project JRE.  Then click "Finish".


Up to this point, Eclipse will just create a regular Java project called "helloworld" for you.  There is nothing yet related to JavaFX. 

The next step is to create the actual Hello World JavaFX file.  The JavaFX plug-in adds a new file type called "JavaFX File".  So select "File" -> "New" -> "Others..." and pick "JavaFX File".  By default, .fx is the JavaFX file extension.


Click "Next" and enter HelloWorld.fx as the file name.


Once you click "Finish", the project build path will automatically be configured with JavaFX libraries as shown below:



Next, type in the Hello World JavaFX script (below) which is based on the NetBeans plug-in tutorial:


import javafx.ui.*;

       
     Frame {
            title: "Hello World JavaFX"
            width: 300
            height: 100
            content: Box {
            content:
            [Label {
                text: "Hello World"
                toolTipText: "Tool tip"
                font: Font {
                    size: 18
                }
                border: EmptyBorder {
                    top: 10
                    left: 10
                }
                background: Color {
                    blue: 255
                    green: 255
                    red: 255
                }
            }]
            }
           
            visible: true
     }
    


To run a JavaFX program from Eclipse, you need to create a JavaFX launch configuration.  Click "Run"->"Run..", select "JavaFX Application" and click on the "New Launch Configuration" button () :


Click on the "Arguments" tab and make sure you enter "HelloWorld" in the "Program arguments" section since the plug-in only sets up the Java main class ("net.java.javafx.FXShell") for you.  Also, you must create a separate launch configuration per JavaFX file in your project.  In this example, I named this launch configuration "HelloWorld JavaFX". Of course, the name of the configuration is your choice.


Finally, click "Apply" and "Run" buttons to run the Hello World program:


It's worth to mention that the Eclipse plug-in comes with an auto-complete editor.  Try pressing "Crtl-Space" to display content assistance:


The Eclipse plug-in for JavaFX works quite the same as the NetBeans plug-in.  The plug-in provides basic editing features and it is currently at the alpha stage, so expect more features to come down the road.







Help us to improve! Give us your feedback:
What you think about the technical content of this post? 10 9 8 7 6 5 4 3 2 1
Did you learn with this post? 10 9 8 7 6 5 4 3 2 1
Is this post helpful? Yes No


MARTY KUBE AND JEFF SZETO
Marty Kube (martykube@yahoo.com) is a Senior Consultant with Beaver Creek Consulting Corp. Marty has 10 years of professional experience and specializes in developing finance and accounting solutions. Marty is a Sun Certified Java Programmer with e...
Go to author's Space


Post stats:
Views:  140709
Favorited:  4
 
Tech Content:
Learning:
Helpful?
91 0
Feedbacks: 97

Post actions:
Add a comment!
Add to my favorites!
Mark this post as viewed
Add a personal note (help)
RSS Feeds




>>>>>>>>>>> Add a comment!
[Fechar]

Este post é fechado - você precisa ter acesso ao post para incluir um comentário.


tone
6/4/2007 3:23pm
 great!
excelent :)
Answer it
oz
7/12/2007 8:14pm
 Thanks
It has been helpful to understand the general status of it
Answer it
Steve P
8/1/2007 6:47pm
 Thanks
I had loaded the JavaFX Plug-in, but could not get my test program to run. Your tutorial was of great help. Many thanks.
Answer it
Wil
9/3/2007 2:55pm
 Thanks
Thanks, now I am understand more of this facinant technology.
Answer it
Ian deSouza
9/26/2007 4:1pm
 Perfect
Just enough info. Thanks!
Answer it
sagar
7/17/2007 5:54am
 wonerfull
goood
Answer it
klenikk
1/24/2008 11:8am
 Dzia³a
To dzia³a :)
Answer it
DayWalker
2/1/2008 6:11am
 Can't find the *.fx file
I always got the following error message if I try to run my application: ---- not found: HelloWorld.fx compile thread: Thread[AWT-EventQueue-0,6,main] compile 0.0 init: 0.031 ---- Any ideas? How can I solve this problem?
Answer it


DayWalker
2/1/2008 6:21am
 the answer
OK guys, my fault. I have solved my problem ;). I don't defined the packagename in the program arguments box :D
Answer it


Junior
4/15/2008 1:14pm
 Can't find the *.fx file
Hey DayWalker, my application when I try run, I got his error message. Which packagename did you use? Forgive me my English!
Answer it
Eric Kolotyluk
4/17/2008 7:35pm
 Can't find HelloWorld.fx
I have the same problem and can't figure out how to fix it. Could someone please describe precisely how to fix it. This is a *very* serious flaw in the plug-in, the plug-in should configure this automatically for you.
Answer it


poluruc
5/1/2008 1:26pm
 your fx file name
You should supply your .fx file name as program argument. like, if your filename is SayHello.fx, then you should supply the argument as SayHello
Answer it
K&T
5/7/2008 12:16am
 Color parameter outside of expected range: Red Green Blue
Well, i'm in hour 2 of this simple hello world program and I have to say Sun's Quick and easy hype isn't living up to the promises. After spending an hour figuring out that the 'official' eclipse plug in wasn't updated and going through classpath issues, i've finally be able to get things to compile. And i get: uncaught FX exception: java.lang.IllegalArgumentException java.lang.IllegalArgumentException: Color parameter outside of expected range: Red Green Blue at new AWTColor(red, green, blue, opacity) ("jar:file:/C:/eclipse/plugins/javafx.eclipse.f3editor_0.0.2/lib/javafxrt.jar!/javafx/ui/Color.fx", Line 98) Any ideas on this one?
Answer it


Fan Boy
5/13/2008 11:50am
 re: K&T
Hmm. Sun has nothing to do with Eclipse, so sounds like noise to me. It took me 5 minutes to get the example running (and eclipse set up with javafx plugin, incidently). If you use the eclipse update site, there should be no "classpath" issues, either. http://download.java.net/general/openjfx/plugins/eclipse/site.xml Sounds like a general competence issue, to me.
Answer it


Karl
5/21/2008 7:12pm
 re: K&T
Try upgrading jdk to at least jdk1.6.0_10. Less than that and I got the Color arg exceptions as well.
Answer it


Einstein_Ian
6/27/2008 11:15am
 Thx.....I like it.
Will,really helpful for me.I found this plug in my company but always can not. I download it at home and it can. Thx a lot. And i hope this technolgy can change web view....
Answer it
Kiran
8/4/2008 8:0pm
 JavaFX
It is really AWESOME ....
Answer it
Arpa
8/22/2008 7:24am
 Thanks
Simple and well explained article!
Answer it
Max P
9/13/2008 8:45am
 Feedback
Hey you did good work thanks for that. But a link to the Eclipse- PlugIn would be nice ;-) Thanks Max
Answer it
Max P.
9/14/2008 9:25am
 eclipse remote update site
" You can get up and running by adding the following as a remote update site: http://download.java.net/general/openjfx/plugins/eclipse/site.xml "
Answer it
tomt
12/8/2008 10:51pm
 Plugin out of date?
The plugin referenced above seems a bit out of date... It wasn't updated with the 1.0 release and is not mentioned anywhere on the Sun site anymore. Has it been abandoned?
Answer it
Lars
12/14/2008 6:57pm
 Updated Plug-in
It seems that an updated Eclipse plug-in is available at http://kenai.com/projects/eplugin/ Here is an tutorial for the new plug-in: http://www.vogella.de/articles/JavaFX/article.html
Answer it
newbie
3/26/2009 0:30am
 I couldn't see the label
Hi, Great article. I followed your instructions and added the site.xml in my RSA v7.0. The Eclipse plug-in was downloaded and installed in my RSA successfully. However, I was only able to see the "Hollo World" label in the debug mode. If I switched the "RUN" mode, the test in the label was invisible. Any idea?
Answer it
Murry
8/22/2008 8:47am
 Error!!
not found: HelloWorld.fx In argument box i have put already HelloWorld.... How do you solve this problem??? Thanks!
Answer it


javaFxer
8/22/2008 7:11pm
 src/HelloWorld.fx
Check the Project Layout. If there are separate source and output folders, put HelloWorld.fx in src folder. src/HelloWorld.fx
Answer it


Caleb
5/9/2009 7:13pm
 File Not Found
I was able to fix this problem(File Not Found) by dragging my HelloWorld.fx into the src folder for the project. I left everything else the same, even though the project was set up as helloworld so the path was helloworld/src/HelloWorld.fx You don't supply src as part of the arguments. You just leave everything the exact way it is, Except drag the HelloWorld.fx into the src folder of the project.
Answer it
Cláudio
5/25/2009 8:27pm
 New link to download the plugin
Hi. The link to download the plugin has changed to: http://download.java.net/general/javafx/eclipse/ Best Regards, Cláudio.
Answer it
Lars
6/2/2009 7:19pm
 JavaFX
New version of the Eclipse plug-in is available. I update my tutorial: http://www.vogella.de/articles/JavaFX/article.html
Answer it
[Fechar]

Você precisa estar logado para dar seu feedback.

Clique aqui para efetuar o login

Caso não tenha um cadastro DevMedia, clique aqui para se cadastrar (gratuito)
 
www.mrbool.com
Copyright 2010 - All rights reserved to DevMedia Group