Beginning Programming with Java For Dummies
Book image
Explore Book Buy On Amazon
Before you can jump into Java GUIs, you need to install JavaFX and Scene Builder. GUI programs have two interesting characteristics:
  • GUI programs typically contain lots of code.

Much of this code differs little from one GUI program to another.

  • GUI programs involve visual elements.

The best way to describe visual elements is to “draw” them. Describing them with code can be slow and unintuitive.

To make your GUI life easier, you can use JavaFX and Scene Builder. With Scene Builder, you describe your program visually. Scene Builder automatically turns your visual description into Java source code and XML code.

Installing Scene Builder

Installing Scene Builder is like installing most software. Here's how you do it:
  1. Visit Scene Builder.
  2. Click the Download button.

    When you do, a list of download options appears.

  3. Click the button corresponding to your computer's operating system (Windows, Mac, or Linux).

    As a result, the download begins. On a Windows computer, you get an .exe file. Double-click the file to begin the installation.

    On a Mac, you get a .dmg file. Depending on your Mac web browser's setting, the browser may or may not expand the .dmg file automatically. If not, double-click the .dmg file to begin the installation.

  4. Follow the installation routine's instructions.

    On a Windows computer, you accept a bunch of defaults.

    On a Mac, you drag the Scene Builder's icon to the Applications folder.

That's it! You've installed Scene Builder.

Installing e(fx)clipse

Eclipse has its own, elaborate facility for incorporating new functionality. An Eclipse tool is called an Eclipse plug-in. When you first install Eclipse, you get many plug-ins by default. Then, to enhance Eclipse's power, you can install many additional plug-ins.

Eclipse's e(fx)clipse plug-in facilitates the creation of JavaFX applications. You can add the plug-in to your existing installation of Eclipse, but it's much simpler to download a new copy of Eclipse (a copy with e(fx)clipse already installed). Here's how you get the new copy of Eclipse:

  1. Visit e(fx)clipse.
  2. Look for the page containing All-in-One downloads.
  3. On the All-in One downloads page, look for a way to download a copy of Eclipse for your operating system.

    Your Eclipse download's word length (32-bit or 64-bit) must match your Java version's word length.

  4. Follow the appropriate links or click the appropriate buttons to begin the download.
  5. Install this new copy of Eclipse on your computer.
Place the new copy of Eclipse in a brand-new folder. That way, you don't have to uninstall your old copy of Eclipse. (In fact, it's helpful to have two separate Eclipse installations on your computer.)

When you launch your new copy of Eclipse, the program prompts you for a place on your hard drive for your workspace (the place on your hard drive where this session's Eclipse projects live). At this point, you have a choice:

  • You can have two different folders for two different workspaces — one workspace for your original copy of Eclipse and a second workspace for your new copy of Eclipse.

Doing so keeps your original work separate from other work. Also, with two different workspaces, you can run both copies of Eclipse simultaneously.

  • Alternatively, you can point both versions of Eclipse to the same folder (and thus, to the same workspace).

Doing so keeps all your work in one place. You don't have to change workspaces. On the minus side, you can't run two copies of Eclipse using the same workspace simultaneously.

Don't fret over the decision you make about Eclipse workspaces. In any copy of Eclipse, you can switch from one workspace to another. You can decide on a particular workspace whenever you launch Eclipse. You can also move from one workspace to another by selecting File → Switch Workspace on Eclipse's main menu.

About This Article

This article is from the book:

About the book author:

Dr. Barry Burd holds an M.S. in Computer Science from Rutgers University and a Ph.D. in Mathematics from the University of Illinois. Barry is also the author of Beginning Programming with Java For Dummies, Java for Android For Dummies, and Flutter For Dummies.

This article can be found in the category: