Book Image

JavaFX 1.2 Application Development Cookbook

By : Vladimir Vivien
Book Image

JavaFX 1.2 Application Development Cookbook

By: Vladimir Vivien

Overview of this book

JavaFX Script enables you to easily create rich Internet applications by embedding multimedia components. Although you can create stylish Internet applications by modifying these default components, even advanced users find it challenging to create impressive feature-rich Internet applications with JavaFX. Also, there are limited JavaFX components to work with and by default these components don't look visually appealing.This book explores limitless possibilities to style your application by coding JavaFX components to display your content in a more appealing fashion. The recipes in this book will help you to create customized JavaFX components with which you can make modern, feature-rich applications.First, you will be introduced to the JavaFX SDK and other development tools available to help you be productive during development. You will create an application in JavaFX by arranging complex graphical components (and non-graphical libraries) with simplified declarative constructs. You will then explore the fun side of JavaFX by using transformation techniques to manipulate the location and dimensions of objects. The next chapter is about the GUI components that are available in the framework, which provide a high level of interactivity. You will learn how to use the media component to play media content. Then we will access data and manipulate data locally or remotely. You will explore many deployment options and integration tips and tricks to take advantage of runtime contexts. Finally, you will interact with pure Java code to read and write files in JavaFX and to establish interactions with computing platforms.
Table of Contents (18 chapters)
JavaFX 1.2 Application Development Cookbook
Credits
About the Author
About the Reviewers
Preface
Mobile JavaFX
JavaFX Composer
JavaFX Products and Frameworks
Best Practices for Development
Best Practices for Deployment

Installing the JavaFX SDK


The JavaFX software development kit (SDK) is a set of core tools needed to compile, run, and deploy JavaFX applications. If you feel at home at the command line, then you can start writing code with your favorite text editor and interact with the SDK tools directly. However, if you want to see code-completion hints after each dot you type, then you can always use an IDE such as NetBeans or Eclipse to get you started with JavaFX (see other recipes on IDEs). This section outlines the necessary steps to set up the JavaFX SDK successfully on your computer. These instructions apply to JavaFX SDK version 1.2.x; future versions may vary slightly.

Getting ready

Before you can start building JavaFX applications, you must ensure that your development environment meets the minimum requirements. As of this writing, the following are the minimum requirements to run the current released version of JavaFX runtime 1.2.

Minimum system requirements

Windows

Mac OS X

Linux/OpenSolaris

  • Windows XP (SP3) or Windows Vista 32-bit (all editions)

  • Java Development Kit (JDK) 6 Update 13

  • Internet Explorer 6, Firefox 3.0

  • Mac OS X version 10.4.1

  • Java Development Kit (JDK) 5 Update 16

  • Safari 3, Firefox 3

  • Ubuntu 8.04

  • OpenSolaris 2009.06

  • Java Development Kit (JDK) 6 Update 13

  • Firefox 3.0

  • GStreamer Media Library

How to do it...

The first step for installing the SDK on you machine is to download it from http://javafx.com/downloads/. Select the appropriate SDK version as shown in the next screenshot.

Once you have downloaded the SDK for your corresponding system, follow these instructions for installation on Windows, Mac, Ubuntu, or OpenSolaris.

Installation on Windows

  1. 1. Find and double-click on the newly downloaded installation package (.exe file) to start.

  2. 2. Follow the directions from the installer wizard to continue with your installation.

Note

Make sure to select the location for your installation. The installer will run a series of validations on your system before installation starts. If the installer finds no previously installed SDK (or the incorrect version), it will download a SDK that meets the minimum requirements (which lengthens your installation).

Installation on Mac OS

  1. 1. Prior to installation, ensure that your Mac OS meets the minimum requirements.

  2. 2. Find and double-click on the newly downloaded installation package (.dmg file) to start.

  3. 3. Follow the directions from the installer wizard to continue your installation.

  4. 4. The Mac OS installer will place the installed files at the following location: /Library/Frameworks/JavaFX.framework/Versions/1.2.

Installation on Ubuntu Linux and OpenSolaris

  1. 1. Prior to installation, ensure that your Ubuntu or OpenSolaris environment meets the minimum requirements.

  2. 2. Locate the newly downloaded installation package to start installation. For Linux, the file will end with *-linux-i586.sh. For OpenSolaris, the installation file will end with *-solaris-i586.sh.

  3. 3. Move the file to the directory where you want to install the content of the SDK.

  4. 4. Make the file executable (chmod 755) and run it. This will extract the content of the SDK in the current directory.

  5. 5. The installation will create a new directory, javafx-sdk1.2, which is your JavaFX home location ($JAVAFX_HOME).

  6. 6. Now add the JavaFX binaries to your system's $PATH variable, (export PATH=$PATH:$JAVAFX_HOME/bin).

When your installation steps are completed, open a command prompt and validate your installation by checking the version of the SDK.

$> javafx -version
$> javafx 1.2.3_b36

You should get the current version number for your installed JavaFX SDK displayed.

How it works...

Version 1.2.x of the SDK comes with several tools and other resources to help developers get started with JavaFX development right away.

The major (and more interesting) directories in the SDK include:

Directory

Description

bin

This directory contains tools for compiling, packaging, documenting, and running JavaFX scripts. They include javafx, javafxc, javafxdoc, and javafxpackager.

docs

This directory contains documentation for various JavaFX tools and the JavaFX APIs.

emulator

This directory contains tools for JavaFX mobile emulator , which is useful for doing mobile development with JavaFX. As of version 1.2 of the SDK, mobile development is only available on the Windows platform.

lib

This directory contains .jar files necessary to build and run JavaFX applications for both desktop and mobile environments.

profiles

This directory contains configuration files for the SDK tools.

samples

This directory provides sample applications to help you get started.