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

Introduction


Today, in the age of Web 2.0, AJAX, and the iPhone, users have come to expect their applications to provide a dynamic and engaging user interface that delivers rich graphical content, audio, and video, all wrapped in GUI controls with animated cinematic-like interactions. They want their applications to be connected to the web of information and social networks available on the Internet.

Developers, on the other hand, have become accustomed to tools such as AJAX/HTML5 toolkits, Flex/Flash, Google Web Toolkit, Eclipse/NetBeans RCP, and others that allow them to build and deploy rich and web-connected client applications quickly. They expect their development languages to be expressive (either through syntax or specialized APIs) with features that liberate them from the tyranny of verbosity and empower them with the ability to express their intents declaratively.

The Java proposition

During the early days of the Web, the Java platform was the first to introduce rich content and interactivity in the browser using the applet technology (predating JavaScript and even Flash). Not too long after applets appeared, Swing was introduced as the unifying framework to create feature-rich applications for the desktop and the browser. Over the years, Swing matured into an amazingly robust GUI technology used to create rich desktop applications. However powerful Swing is, its massive API stack lacks the lightweight higher abstractions that application and content developers have been using in other development environments. Furthermore, the applet's plugin technology was (as admitted by Sun) neglected and failed in the browser-hosted rich applications against similar technologies such as Flash.

Enter JavaFX

The JavaFX is Sun's (now part of Oracle) answer to the next generation of rich, web-enabled, deeply interactive applications. JavaFX is a complete platform that includes a new language, development tools, build tools, deployment tools, and new runtimes to target desktop, browser, mobile, and entertainment devices such as televisions. While JavaFX is itself built on the Java platform, that is where the commonalities end. The new JavaFX scripting language is designed as a lightweight, expressive, and a dynamic language to create web-connected, engaging, visually appealing, and content-rich applications.

The JavaFX platform will appeal to both technical designers and developers alike. Designers will find JavaFX Script to be a simple, yet expressive language, perfectly suited for the integration of graphical assets when creating visually-rich client applications. Application developers, on the other hand, will find its lightweight, dynamic type inference system, and script-like feel a productivity booster, allowing them to express GUI layout, object relationship, and powerful two-way data bindings all using a declarative and easy syntax. Since JavaFX runs on the Java Platform, developers are able to reuse existing Java libraries directly from within JavaFX, tapping into the vast community of existing Java developers, vendors, and libraries.

This is an introductory chapter to JavaFX. Use its recipes to get started with the platform. You will find instructions on how to install the SDK and directions on how to set up your IDE. The chapter also provides a high-level introduction to the main features of the JavaFX scripting language such as class creation, variable declaration, data types, JavaFX functional programming support, sequences, and loops.