Chapter 1
Introduction to JavaFX

Key Skills & Concepts

• Installing JavaFX

• Installing NetBeans

• Using NetBeans

Welcome to JavaFX: A Beginner’s Guide. I am sure you are anxious to begin your journey into the exciting world of JavaFX development, and this is the perfect place to start. Before you begin you need to have a fully capable development environment. This chapter will cover the basic knowledge needed to create and establish a JavaFX development environment that will allow you to create excitingly rich interactive applications. It will also answer many of the questions you may have about what JavaFX does, and how it does it.

What Is JavaFX?

If you have ever used an Adobe Flash game, or seen an application in Microsoft Silverlight, then you have a pretty good idea of what JavaFX is. I know, it’s not fair to compare JavaFX to these other environments, but if you have never seen JavaFX before, then I have to compare it to something.

JavaFX delivers full-featured, interactive experiences to users in much the same way as Flash or Silverlight. However, one of the major differences between JavaFX and the others is that JavaFX is platform independent. Because JavaFX is fully integrated with the Java Runtime, any device or system that can run Java can also serve up JavaFX experiences.

NOTE

The JavaFX development environment currently allows for deployment on the Desktop, Web, television, and mobile devices.

What Is Needed for JavaFX Development?

Before you jump right into development, you should examine the list of requirements as outlined in the following section. Think of them as the prerequisites for a successful and rewarding learning process. You should have at least a basic knowledge of the following skills as well as access to the listed software.

Required Skills and Knowledge

Prior development experience is not required to follow along with this book. If you have never created a single application or developed a basic web page, you will still have the skills needed to learn JavaFX. The examples and lessons in this book are specifically designed to teach you JavaFX development, as well as the JavaFX scripting language, simultaneously and from the ground up.

NOTE

The language that JavaFX applications are developed in is called JavaFX Script.

That being said, any experience you have in scripting is going to help you grasp the concepts of JavaFX Script even faster. A basic knowledge of the following concepts, although not necessary, will also help you get up to speed even faster:

Java development JavaFX and Java share more than just their root names. If you have ever written a Java applet—and, more importantly, deployed a Java applet to a web page—you should easily understand the deployment process for JavaFX.

HTML Even though JavaFX can be deployed as standalone desktop applications and as mobile device applications, most people will develop for the Web. One of the great features of the JavaFX development environment is that you will not need to create a single web page to develop for the Web. However, a basic understanding of HTML will help you understand what is going on behind the scenes of your development.

Drag and drop Many things in JavaFX can be created by using the drag-and-drop interface. If you have ever mocked up an application in Visual Basic by dropping objects onto an empty form, you have an advantage in developing JavaFX.

These skills are by no means required, and a lack in any of these areas will not affect your ability to learn JavaFX. Whether you are a seasoned professional developer or a novice who has yet to write your first application, you will be able to easily develop in JavaFX after reading this book. The next section lists the software you will be working with in this book to develop JavaFX.

Required Software

This section serves as a brief introduction to the software you will be using throughout this book. A few different software elements are used in JavaFX development, and you will be very familiar with these by the end of this chapter. Don’t worry if you do not have any of these software elements yet, or have never even heard of one or two of them. By then end of this chapter you will have downloaded and installed all the software required to facilitate JavaFX development.

JavaFX SDK The JavaFX SDK (Software Development Kit) is the major package needed for JavaFX development. The JavaFX SDK contains all the items needed to develop JavaFX applications using JavaFX Script.

Java SE JDK The Java SE JDK (Standard Edition Java Development Kit) is required to compile your JavaFX script into executable code. The JDK is the base for all Java development.

NetBeans NetBeans is the development environment you will use to create your JavaFX apps. Think of NetBeans as a specialized text editor that can use both the JavaFX SDK and the Java SE JDK to compile text into an executable app.

All the pieces of software listed here are free and can be easily downloaded. The next section of this chapter walks you through downloading and installing the required software.

Downloading and Installing the Required Software

Both NetBeans and JavaFX rely on the Java SE JRE (Standard Edition Java Runtime Environment). Therefore, the Java SE JRE should be installed on your system first. However, the NetBeans 6.9 install not only will automatically install the latest version of the Java SE JRE for you, but will also install the JavaFX SDK. Therefore, you are going to install all your required software at one time by installing NetBeans 6.9.

NetBeans

NetBeans is an open-source IDE (Integrated Development Environment) that can be used for developing on many different platforms. NetBeans can be used for C/C++, Java, JavaScript, and PHP development, as well as JavaFX. When following the examples in this book, you will do all your JavaFX development within a NetBeans workspace.

The first step is to download the latest version of NetBeans for JavaFX. The latest version of NetBeans can be downloaded from www.netbeans.org.

CAUTION

The latest version of NetBeans, at the time this book was written, was the NetBeans 6.9 Beta for JavaFX. NetBeans can be downloaded for different languages, and for the purposes of this book you need to download the version of NetBeans 6.9 that is specifically for JavaFX. This will make more sense when you visit the NetBeans download page.

Once you are at the NetBeans download page, the choice of available packages may seem daunting. Fear not, because there is only one flavor of NetBeans 6.9 you need to worry about. You want to download the NetBeans IDE for JavaFX (see Figure 1-1).

Image

Figure 1-1 NetBeans download page

CAUTION

The download from NetBeans labeled “All” is the version of NetBeans for all available technologies. All the examples in this book will still work if you happen to download this version, but you should try to stick with the NetBeans IDE for JavaFX.

Simply follow the installation wizard and you should have no problem successfully preparing NetBeans for development. The installation wizard will recommend default locations for the installation of the NetBeans IDE and the Java JDK; just accept the default locations and the remainder of the installation will be a breeze.

NOTE

If Java has never been installed on your computer, you may need to manually install the latest JDK before installing NetBeans.

When the NetBeans installation is complete, the NetBeans IDE should auto-start. If NetBeans does not restart, you may need to bring it up manually. The NetBeans IDE will open to the development start page (see Figure 1-2). The purpose of the NetBeans start page is to offer you tips and news about developing in NetBeans and JavaFX.

Image

Figure 1-2 The NetBeans default start page

TIP

Uncheck the box marked “Show On Startup” to bypass the start page in the future.

At this point, NetBeans is configured and ready for use. The NetBeans installer will ask you to register NetBeans. This step is suggested but not required. Registering your product will give you access to news about upgrades and the NetBeans forums.


Try This Configure Your NetBeans

A developer should be comfortable using their IDE. Try to customize the look and feel of your NetBeans IDE to make it a more comfortable place for you to work. When your IDE has a familiar look and feel, you will be much more apt to have creative development sessions.

Open your NetBeans IDE and from the menu bar select Tools | Options. Explore the options provided to you. Experiment with these options by setting different ones and taking note of how they affect the IDE. Find the most comfortable options for you and your method of development.

images Chapter 1 Self Test

1. What is the name of the open-source development environment you will use throughout this book?

2. True or false? You should download the version of NetBeans for All Developers.

3. True or false? The Java JDK will be installed for you automatically if needed (if you have the JRE installed).

4. Which NetBeans settings can you accept the default values for during installation?

5. What is the difference between the JavaFX SDK and the Java JDK?

6. What is the purpose of the NetBeans start page?

7. True or false? You must successfully register NetBeans before using it.

8. At what website is NetBeans available?

9. Name two other applications that closely resemble the functionality of JavaFX.

10. JavaFX will compile for the Desktop, Web, and what other platforms?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.13.164