28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2 ■ Setting Up Your <strong>Java</strong> 8 IDE: An Introduction to NetBeans 8.0<br />

In case you are wondering, the start page displays every time you start the NetBeans IDE, and if you wanted to<br />

open the Start Page tab later on, perhaps to explore the Media Library section (demos) and tutorials, you can! To<br />

open the start page at any time, you use the NetBeans IDE 8.0 Help menu and the Start Page submenu. For future<br />

reference, I usually notate a menu sequence like this: Help ➤ Start Menu.<br />

The first thing that you will want to do in NetBeans IDE 8.0 is create a new InvinciBagel game project! To<br />

accomplish this, you will use the NetBeans 8.0 New Project series of dialogs. This is one of those helpful <strong>Java</strong><br />

programming features that I mentioned earlier (see the section “NetBeans IDE 8.0 Is Smart: Put Your Editing into<br />

Hyperdrive”) that creates a bootstrap project with the correct <strong>Java</strong>FX libraries, .main() and .start() methods, and<br />

import statements (for more details, see Chapter 3).<br />

Click the File menu, at the top-left corner of the DE, as displayed in Figure 2-4 (left), and then select New Project<br />

(the first menu item). Note that to the right of this selection, there is a keyboard shortcut given (Ctrl+Shift+N), in case<br />

you want to memorize it.<br />

If you want to use this keyboard short-cut to bring up the New Project series of dialogs, hold down the CTRL and<br />

Shift keys on your keyboard (both at the same time), and while they are depressed (held down), press the N key. This<br />

will do the same thing as using the File ➤ New Project menu sequence.<br />

The first in the series is the Choose Project dialog, shown in Figure 2-4 (right). Because you are going to use the<br />

powerful <strong>Java</strong>FX new media engine in your game, select <strong>Java</strong>FX from the list of programming language categories in<br />

the Categories pane, and because a game is a type of application, select <strong>Java</strong>FX Application from the Projects pane.<br />

Remember that Oracle made <strong>Java</strong>FX a part of <strong>Java</strong> 7 and <strong>Java</strong> 8, so a <strong>Java</strong>FX game is also a <strong>Java</strong> game, whereas<br />

before <strong>Java</strong> 7 (in <strong>Java</strong> 6), <strong>Java</strong>FX was its own separate programming language! The <strong>Java</strong>FX engine had to be recoded as<br />

a <strong>Java</strong> (7 and 8) API (set of libraries) for it to become a seamless part of the <strong>Java</strong> programming language. The <strong>Java</strong>FX<br />

API replaces AWT (Abstract Windowing Toolkit) and Swing, and although these older UI design libraries can still be<br />

used in <strong>Java</strong> projects, they are normally used only by legacy (older) <strong>Java</strong> code so that those projects can compile and<br />

run in <strong>Java</strong> 7 and 8. You will be compiling and running the new project you are creating here a bit later in this chapter.<br />

Note that there is a Description pane below the other panes that will tell you what your selections will give you.<br />

In this case, that would be a new <strong>Java</strong> application with enabled <strong>Java</strong>FX features; here, “enabled” indicates that the<br />

<strong>Java</strong>FX API libraries will be included (and started) in the <strong>Java</strong> application project’s class and methods, as you will soon<br />

see in the code (for further information on what the code means, see Chapter 3).<br />

Click the Next button to advance to the next dialog in the series, which is the Finding Feature dialog, shown in<br />

Figure 2-5. This dialog displays a progress bar while it is “Activating <strong>Java</strong>FX 2,” which equates to installing the <strong>Java</strong>FX<br />

API libraries in your project code infrastructure. You will find that sometimes <strong>Java</strong>FX 8 is still referred to as <strong>Java</strong>FX 2<br />

(2.3 was the latest version of <strong>Java</strong>FX before people started using the name <strong>Java</strong>FX 8, probably to sync up with <strong>Java</strong> 8).<br />

I have also seen discussion of a <strong>Java</strong>FX 3, which is now being called <strong>Java</strong>FX 8, and because <strong>Java</strong>FX is now a part of <strong>Java</strong> 8,<br />

I am going to refer to it simply as <strong>Java</strong>FX for the duration of this book.<br />

Figure 2-5. Step 2: Finding Feature dialog, showing the progress bar for the process of activating <strong>Java</strong>FX<br />

www.it-ebooks.info<br />

25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!