Java Reference
In-Depth Information
25.1 Introduction
25.2 JavaFX Scene Builder and the
NetBeans IDE
25.3 JavaFX App Window Structure
25.4 Welcome App—Displaying Text and
an Image
25.4.1 Creating the App's Project
25.4.2 NetBeans Projects Window—
Viewing the Project Contents
25.4.3 Adding an Image to the Project
25.4.4 Opening JavaFX Scene Builder from
NetBeans
25.4.7 Adding and Configuring a Label
25.4.8 Adding and Configuring an
ImageView
25.4.9 Running the Welcome App
25.5 Tip Calculator App—Introduction to
Event Handling
25.5.1 Test-Driving the Tip Calculator App
25.5.2 Technologies Overview
25.5.3 Building the App's GUI
25.5.4 TipCalculator Class
25.5.5 TipCalculatorController Class
25.6 Features Covered in the Online
JavaFX Chapters
25.7 Wrap-Up
25.4.5
Changing to a VBox Layout Container
25.4.6
Configuring the VBox Layout
Container
Summary | Self-Review Exercises | Answers to Self-Review Exercises | Exercises | Making a Difference
25.1 Introduction
[ Note: The prerequisites for this chapter are Chapters 1-11. This chapter does not require
that you've read Chapter 12, GUI Components: Part 1, which discusses Swing GUI.]
A graphical user interface ( GUI ) presents a user-friendly mechanism for interacting with
an app. A GUI (pronounced “GOO-ee”) gives an app a distinctive “look-and-feel.” GUIs
are built from GUI components . These are sometimes called controls or widgets —short for
window gadgets. A GUI component is an object with which the user interacts via the
mouse, the keyboard or another form of input, such as voice recognition.
Look-and-Feel Observation 25.1
Providing different apps with consistent, intuitive user-interface components gives users a
sense of familiarity with a new app, so that they can learn it more quickly and use it more
productively.
History of GUI in Java
Java's original GUI library was the Abstract Window Toolkit (AWT). Swing (Chapters 12
and 22) was added to the platform in Java SE 1.2. Since then, Swing has remained the pri-
mary Java GUI technology. Swing is now in maintenance mode—Oracle has stopped de-
velopment and will provide only bug fixes going forward; however, it will remain part of
Java and is still widely used.
Java's GUI, graphics and multimedia API of the future is JavaFX . Sun Microsystems
(acquired by Oracle in 2010) announced JavaFX in 2007 as a competitor to Adobe Flash
and Microsoft Silverlight. JavaFX 1.0 was released in 2008. Prior to version 2.0, devel-
opers used JavaFX Script—which was similar to JavaScript—to write JavaFX apps. The
JavaFX Script source code compiled to Java bytecode, allowing JavaFX apps to run on the
Java Virtual Machine. Starting with version 2.0 in 2011, JavaFX was reimplemented as a
set of Java libraries that could be used directly in Java apps. Some of the benefits of JavaFX
vs. Swing include:
 
 
Search WWH ::




Custom Search