Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Overview

In Pro JavaFX 2: A Definitive Guide to Rich Clients with Java Technology, Jim Weaver, Weiqi Gao, Stephen Chin, Dean Iverson, and Johan Vos show you how you can use the JavaFX platform to create rich-client Java applications. You'll see how JavaFX provides a powerful Java-based UI platform capable of handling large-scale data-driven business applications.

Covering the JavaFX API, development tools, and best practices, this book provides code examples that explore the exciting new features provided with JavaFX 2. It contains engaging tutorials that cover virtually every facet of JavaFX development and reference materials on JavaFX that augment the JavaFX API documentation. Written in an engaging and friendly style, Pro JavaFX 2 is an essential guide to JavaFX 2.

What you'll learn

  • How to get started with JavaFX 2, including downloading the SDK and available tools.

  • How to express user interfaces with a declarative-style enabled by the JavaFX builder classes.

  • How to use property binding to keep the UI easily in sync with the model.

  • How to use the rich set of JavaFX UI controls, charts, shapes, effects, transformations, and animations to create stunning, responsive, user interfaces.

  • How to use the powerful JavaFX layout classes to define the user interface in a cross-platform fashion.

  • How to leverage the observable collection classes to observe changes in, and bind to, Java collections.

  • How to use the JavaFX media classes to play audio and video.

  • How to interact with external application services to create an enterprise application with JavaFX.

  • How to use the JavaFX API with alternative languages such as Scala, Groovy, and Visage.

  • How to uncover the JavaFX APIs to whatever degree you choose. The tutorials, reference materials, and pointers to resources are exhaustive.

Who this book is for

Application developers, graphic designers, and IT decision makers. Not only does this book contain comprehensive technical information for developers and designers, it builds a compelling case for choosing JavaFX for web applications and RIAs.

Subscriber Reviews

Average Rating: 4 out of 5 rating Based on 2 Ratings

"Average" - by Fender56 on 20-MAY-2013
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
One of the frustrations I have with this book is while it tells the reader what the various classes and methods do, it doesn't tell us when or why we would want to use them.  

From Chapter 3: "You can register InvalidationListener objects to
an Observable object to receive invalidation events."

OK, great.  When might I need such a listener?  When is it more appropriate to use a ChangeListener?  What use case would be better suited to one over the other?

Chapter 5 deals with using JavaFX UI controls.  It spends at least ten pages instructing the reader how to click on the various controls included in the example code once compiled.  This passes for "instruction".  I think we're all pretty well versed on how to *react* to a user interface.  What I was looking for was how it works underneath the hood - how to build, when to use one type of component over another, how to dynamically build a ChoiceBox data model, etc.

I realize that the reader is expected to bring certain knowledge to the table when embarking upon a new learning experience.  But this book feels more like a lecture than an interactive learning endeavour.  Perhaps I haven't brought my share to the table.  OK that's fair enough.  

Typically, for me anyway, it takes several books on a given technology to get the whole picture.  There's always some little tidbit of information one book has that the others have left out.
But given that this book the only one I can find that deals with JavaFX 2.0,  I'm left to fend for myself through Google searches and tutorials.

One of the things that this book doesn't do is spend a lot of time going over history.  Too many java books do that: they want to tell us the entire history of Java and waste our time in doing so.   This book, thankfully, is sparse on history - just enough to tell me why I'm seeing most of the reference material talking about scripting and xml that doesn't seem to be true any more.  (The answer of course is that most of the material I've found deals with JavaFX 1.0,  while JavaFX 2.0 is quite a bit different).

And maybe that's at the heart of the matter here.  JavaFX 2.0 is still in it's early stages so there isn't yet enough experience in the java-scape for authors to learn from each other and improve on each other's work.


Report as Inappropriate

"Chapter 1 is good, but Objects are jumbled " - by MikeekiM on 25-JUN-2012
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
Source should be cleaner, for teaching.

A Better Example 1:


package profx_helloearthrise;

import java.util.Calendar;
import java.util.GregorianCalendar;
import javafx.animation.*;
import javafx.application.Application;
import javafx.geometry.VPos;
import javafx.scene.Group;
import javafx.scene.GroupBuilder;
import javafx.scene.Scene;
import javafx.scene.SceneBuilder;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.ImageViewBuilder;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.RectangleBuilder;
import javafx.scene.text.*;
import javafx.stage.Stage;
import javafx.util.Duration;

/**
*
* @author x
*/
public class ProFX_HelloEarthRise
extends Application
{

/**
  * @param args the command line arguments
  */
public static void main( String[] args )
{
  launch( args );
}


@Override
public void start( Stage primaryStage )
{
  GregorianCalendar gcNow = new GregorianCalendar();
  int currentYear = gcNow.get( Calendar.YEAR );

  // Month is Zero based, subtract 1.
  GregorianCalendar gc1968 = new GregorianCalendar( 1968, 12 - 1, 25 );
  int landingYear = gc1968.get( Calendar.YEAR );

  int yearsPast = currentYear - landingYear;
  String sYearsPast = Integer.toString( yearsPast );


  String message = "Earthrise at Christmas: "
   + "Some years ago [ " + sYearsPast
   + " ] this Christmas, a turbulent world "
   + "looked to the heavens for a unique view of our home "
   + "planet.  This photo of Earthrise over the lunar horizon "
   + "was taken by Apollo 8 crew in December 1968, showing "
   + "Earth for the first time as it appears from deep space.  "
   + "Astronauts Frank Borman, Jim Lovell and William Anders "
   + "had become the first humans to leave Earth orbit, "
   + "entering lunar orbit on Christmas Eve.  "
   + "In a historic live broadcast that night, the crew took turns "
   + "reading from the book of Genesis, closing with a holiday wish "
   + "from Commander Borman: "
   + "\"We close with good night, good luck, a Merry Christmas, "
   + "and God bless all of you -- all of you on the good Earth.\""
   ;

  // Text Earth Properties
  Text textEarth =  TextBuilder.create()
    .layoutY( 100 )
    .textOrigin( VPos.TOP )
    .textAlignment( TextAlignment.JUSTIFY )
    .wrappingWidth( 400 )
    .text( message )
    .fill( Color.rgb ( 187, 195, 107 ))
    .font( Font.font( "SansSerif", FontWeight.BOLD, 24 ))
    .build();

  TranslateTransition transTransition =  TranslateTransitionBuilder.create()
   .duration( new Duration( 75000 ))
   .node( textEarth )
   .toY( -820 )
   .interpolator( Interpolator.LINEAR )
   .cycleCount( Timeline.INDEFINITE )
   .build();

  ImageView viewEarth = ImageViewBuilder.create()
   .image( new Image( "http://projavafx.com/images/earthrise.jpg" ))
   .build();

  Rectangle rectEarth = RectangleBuilder.create()
   .width( 430 )
   .height( 85 )
   .build();

  Group groupEarthText = GroupBuilder.create()
   .layoutX( 50 )
   .layoutY( 180 )
   .children( textEarth )
   .clip( rectEarth )
   .build();

  Group groupEarth
   = GroupBuilder.create()
   .children( viewEarth, groupEarthText )
   .build();

     Scene scene  = SceneBuilder.create()
    .width(516)
   .height(387)
   .root( groupEarth )
   .build();

    primaryStage.setScene( scene );
  primaryStage.setTitle( "Hello Earthrise. ");
  primaryStage.show();

  transTransition.play();

}  // end start()

} // end class

Report as Inappropriate

Table of Contents