About the Authors |
|
xix | |
About the Technical Reviewer |
|
xxi | |
Acknowledgments |
|
xxiii | |
Introduction |
|
xxv | |
|
Chapter 1 Getting Started |
|
|
1 | (46) |
|
Downloading Required Software |
|
|
1 | (2) |
|
Installing the Java 9 Development Kit |
|
|
3 | (11) |
|
Installing the JDK on Microsoft Windows |
|
|
3 | (4) |
|
Installing the JDK on MacOS X |
|
|
7 | (4) |
|
Installing the JDK on Linux |
|
|
11 | (3) |
|
Setting Environment Variables |
|
|
14 | (8) |
|
Setup Windows Environment Variables |
|
|
16 | (3) |
|
Setting Up MacOS X/Linux Environment Variables |
|
|
19 | (3) |
|
|
22 | (1) |
|
Installing the NetBeans IDE |
|
|
23 | (6) |
|
Creating a JavaFX HelloWorld Application |
|
|
29 | (12) |
|
|
30 | (4) |
|
Using an Editor and the Terminal (the Command-Line Prompt) |
|
|
34 | (4) |
|
Using Gradle on the Command-Line Prompt |
|
|
38 | (3) |
|
Walking Through the HelloWorld Source Code |
|
|
41 | (2) |
|
|
42 | (1) |
|
|
42 | (1) |
|
Packaging a JavaFX Application |
|
|
43 | (1) |
|
Downloading the Book's Source Code |
|
|
44 | (1) |
|
|
45 | (2) |
|
Chapter 2 JavaFX and Jigsaw |
|
|
47 | (22) |
|
|
48 | (4) |
|
|
48 | (1) |
|
|
49 | (1) |
|
|
49 | (3) |
|
|
52 | (3) |
|
|
52 | (1) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
55 | (8) |
|
|
56 | (1) |
|
|
57 | (1) |
|
|
58 | (5) |
|
An Example HelloWorld JavaFX 9 Modular Application |
|
|
63 | (5) |
|
|
63 | (1) |
|
Create a Module Definition |
|
|
63 | (1) |
|
Create Main Application Code |
|
|
64 | (1) |
|
|
65 | (1) |
|
|
65 | (1) |
|
|
66 | (1) |
|
Package Application as JAR |
|
|
66 | (1) |
|
|
67 | (1) |
|
Display Module Description |
|
|
67 | (1) |
|
|
68 | (1) |
|
Chapter 3 JavaFX Fundamentals |
|
|
69 | (34) |
|
|
69 | (5) |
|
|
74 | (4) |
|
|
78 | (1) |
|
|
79 | (9) |
|
|
79 | (4) |
|
|
83 | (1) |
|
|
84 | (2) |
|
|
86 | (1) |
|
|
86 | (2) |
|
|
88 | (7) |
|
|
88 | (4) |
|
|
92 | (1) |
|
|
92 | (1) |
|
|
92 | (1) |
|
|
93 | (1) |
|
Semitransparent Gradients |
|
|
94 | (1) |
|
Reflective Cycle Gradients |
|
|
94 | (1) |
|
|
95 | (6) |
|
|
97 | (3) |
|
|
100 | (1) |
|
|
101 | (2) |
|
Chapter 4 Lambdas and Properties |
|
|
103 | (32) |
|
|
103 | (4) |
|
|
104 | (3) |
|
|
107 | (1) |
|
|
108 | (3) |
|
|
111 | (6) |
|
An Example Case: Cats Large and Small |
|
|
111 | (1) |
|
|
112 | (4) |
|
|
116 | (1) |
|
|
117 | (5) |
|
|
117 | (1) |
|
|
117 | (1) |
|
Types of JavaFX Properties |
|
|
118 | (2) |
|
|
120 | (1) |
|
|
121 | (1) |
|
|
122 | (2) |
|
|
123 | (1) |
|
|
123 | (1) |
|
|
124 | (1) |
|
|
124 | (10) |
|
|
126 | (4) |
|
|
130 | (4) |
|
|
134 | (1) |
|
Chapter 5 Layouts and Scene Builder |
|
|
135 | (36) |
|
|
135 | (15) |
|
|
136 | (4) |
|
|
140 | (4) |
|
|
144 | (1) |
|
|
144 | (1) |
|
|
145 | (5) |
|
|
150 | (20) |
|
Download and Installing Scene Builder |
|
|
151 | (1) |
|
|
151 | (18) |
|
|
169 | (1) |
|
|
170 | (1) |
|
Chapter 6 User Interface Controls |
|
|
171 | (56) |
|
|
171 | (14) |
|
|
173 | (1) |
|
|
174 | (1) |
|
Example: Working with Third-Party Font Packs as Icons |
|
|
174 | (7) |
|
|
181 | (4) |
|
|
185 | (13) |
|
|
185 | (1) |
|
|
186 | (1) |
|
|
187 | (1) |
|
|
187 | (2) |
|
|
189 | (1) |
|
|
189 | (1) |
|
Source Code of ButtonFun.java |
|
|
190 | (6) |
|
|
196 | (2) |
|
|
198 | (6) |
|
Creating Menus and Menu Items |
|
|
198 | (1) |
|
Invoking a Selected Menultem |
|
|
199 | (1) |
|
Example: Working with Menus |
|
|
200 | (2) |
|
|
202 | (1) |
|
Additional Ways to Select Menus and Menu Items |
|
|
203 | (1) |
|
The ObservableList Collection Class |
|
|
204 | (1) |
|
|
204 | (5) |
|
|
205 | (3) |
|
|
208 | (1) |
|
|
209 | (12) |
|
|
209 | (1) |
|
Making Table Cells Editable |
|
|
210 | (2) |
|
Example: Bosses and Employees Working with Tables |
|
|
212 | (9) |
|
Generating a Background Process |
|
|
221 | (5) |
|
Creating a Background Task |
|
|
221 | (1) |
|
Example: File Copy Progress Dialog (BackgroundProcesses) |
|
|
222 | (3) |
|
|
225 | (1) |
|
|
226 | (1) |
|
|
227 | (38) |
|
|
227 | (4) |
|
|
228 | (2) |
|
|
230 | (1) |
|
|
231 | (24) |
|
|
231 | (2) |
|
|
233 | (1) |
|
|
234 | (1) |
|
|
235 | (20) |
|
|
255 | (2) |
|
|
255 | (1) |
|
|
255 | (1) |
|
|
256 | (1) |
|
JavaFX Transition Classes |
|
|
256 | (1) |
|
Point-and-Click Game Example |
|
|
257 | (4) |
|
|
257 | (4) |
|
|
261 | (1) |
|
|
261 | (1) |
|
|
262 | (2) |
|
|
264 | (1) |
|
Chapter 8 JavaFX Printing |
|
|
265 | (18) |
|
|
265 | (3) |
|
|
268 | (1) |
|
|
268 | (6) |
|
|
270 | (2) |
|
|
272 | (2) |
|
|
274 | (1) |
|
Example WebDocPrinter Application |
|
|
275 | (7) |
|
|
277 | (4) |
|
|
281 | (1) |
|
|
282 | (1) |
|
Chapter 9 Media and JavaFX |
|
|
283 | (44) |
|
|
283 | (2) |
|
|
285 | (29) |
|
|
285 | (2) |
|
MP3 Audio Player Source Code |
|
|
287 | (14) |
|
|
301 | (13) |
|
|
314 | (9) |
|
|
314 | (1) |
|
|
314 | (1) |
|
|
315 | (1) |
|
|
316 | (4) |
|
|
320 | (3) |
|
Simulating Closed Captioning: Marking a Position in a Video Media |
|
|
323 | (2) |
|
Closed Captioning Video Example |
|
|
323 | (2) |
|
|
325 | (1) |
|
|
325 | (2) |
|
Chapter 10 JavaFX on the Web |
|
|
327 | (40) |
|
JavaFX Web and HTTP2 APIs |
|
|
328 | (2) |
|
|
330 | (1) |
|
WebEngine's load() Method |
|
|
330 | (1) |
|
WebEngine's loadContent() Method |
|
|
331 | (1) |
|
|
331 | (34) |
|
Obtaining an org.w3c.dom.Document (DOM) Object |
|
|
331 | (1) |
|
Using Raw XML Content as a String |
|
|
332 | (1) |
|
|
332 | (1) |
|
Communicating from Java to JavaScript |
|
|
333 | (1) |
|
Communicating from JavaScript to Java |
|
|
333 | (2) |
|
Java 9 Module jdk.incubator.httpclient |
|
|
335 | (4) |
|
|
339 | (1) |
|
|
340 | (1) |
|
|
341 | (1) |
|
|
342 | (3) |
|
Viewing HTML5 Content (WebView) |
|
|
345 | (1) |
|
Example: An HTML5 Analog Clock |
|
|
345 | (1) |
|
|
346 | (3) |
|
|
349 | (1) |
|
|
349 | (1) |
|
|
350 | (1) |
|
|
351 | (2) |
|
One-Liner: Reading an Input Stream into a String |
|
|
353 | (1) |
|
|
354 | (9) |
|
|
363 | (1) |
|
|
364 | (1) |
|
|
365 | (2) |
|
|
367 | (24) |
|
Basic 3D Scenes in JavaFX |
|
|
367 | (2) |
|
A Very Basic 3D Scene Example |
|
|
367 | (2) |
|
|
369 | (1) |
|
Adding a Primitive Example |
|
|
369 | (5) |
|
Simple Translate and Rotate Example |
|
|
371 | (1) |
|
Multiple Primitive Transformation Example |
|
|
372 | (1) |
|
All Together Now: Grouped Primitives |
|
|
373 | (1) |
|
Interacting with Your Scene |
|
|
374 | (5) |
|
Primitive Picking for Primitives |
|
|
375 | (1) |
|
First Person Movement Using the Keyboard |
|
|
376 | (1) |
|
First Person Camera Movement Using the Mouse |
|
|
377 | (2) |
|
|
379 | (11) |
|
Custom 3D Objects Using the TriangleMesh Class |
|
|
380 | (1) |
|
|
380 | (3) |
|
|
383 | (5) |
|
|
388 | (1) |
|
|
389 | (1) |
|
|
390 | (1) |
|
Chapter 12 JavaFX and Arduino |
|
|
391 | (40) |
|
|
391 | (2) |
|
|
393 | (8) |
|
|
394 | (2) |
|
|
396 | (1) |
|
|
396 | (2) |
|
|
398 | (1) |
|
|
398 | (2) |
|
|
400 | (1) |
|
Orientation Visualizer Example |
|
|
401 | (5) |
|
|
406 | (1) |
|
|
406 | (1) |
|
Java Simple Serial Connector |
|
|
406 | (1) |
|
JavaFX, the Charting API, and Orientation |
|
|
406 | (24) |
|
Creating the Module Project |
|
|
407 | (2) |
|
|
409 | (3) |
|
|
412 | (2) |
|
|
414 | (1) |
|
|
414 | (6) |
|
Building and Running the Project |
|
|
420 | (1) |
|
|
421 | (4) |
|
Adding More Functionality |
|
|
425 | (2) |
|
Building and Running the Project |
|
|
427 | (1) |
|
|
428 | (2) |
|
|
430 | (1) |
|
|
430 | (1) |
|
Chapter 13 JavaFX on Mobile |
|
|
431 | (36) |
|
JavaFXPorts: The Port to Mobile |
|
|
431 | (2) |
|
JavaFXPorts Under the Hood |
|
|
431 | (1) |
|
Getting Started with JavaFXPorts |
|
|
432 | (1) |
|
Hello Mobile World Example |
|
|
433 | (5) |
|
|
435 | (2) |
|
Submitting the App to the Stores |
|
|
437 | (1) |
|
|
438 | (3) |
|
|
438 | (1) |
|
|
439 | (2) |
|
|
441 | (1) |
|
Example: The BasketStats App |
|
|
441 | (24) |
|
|
441 | (6) |
|
|
447 | (3) |
|
|
450 | (3) |
|
|
453 | (4) |
|
|
457 | (7) |
|
|
464 | (1) |
|
|
465 | (1) |
|
|
465 | (2) |
|
Chapter 14 JavaFX and Gestures |
|
|
467 | (24) |
|
Recognizing Gestures in Your Application |
|
|
467 | (2) |
|
Example: Animating Shapes Along a Path Using Touch Events |
|
|
469 | (4) |
|
|
472 | (1) |
|
Touching, Rotating, and Zooming in 3D |
|
|
473 | (3) |
|
The Leap Motion Controller |
|
|
476 | (13) |
|
|
477 | (1) |
|
Getting Started with the Leap SDK |
|
|
478 | (1) |
|
Adding the Leap SDK to a JavaFX Project |
|
|
479 | (1) |
|
The Hands Tracking Example |
|
|
479 | (1) |
|
|
480 | (3) |
|
|
483 | (2) |
|
|
485 | (2) |
|
Building and Running the Project |
|
|
487 | (2) |
|
|
489 | (1) |
|
|
489 | (2) |
|
|
491 | (34) |
|
|
491 | (14) |
|
|
493 | (2) |
|
Web and Mobile Look and Feels |
|
|
495 | (2) |
|
Applying the JavaFX CSS Theme |
|
|
497 | (3) |
|
An Example of Switching Themes |
|
|
500 | (5) |
|
|
505 | (8) |
|
|
506 | (5) |
|
How to Define -fx- Based Styling Properties (Rules) |
|
|
511 | (1) |
|
Obeying the JavaFX CSS Rules |
|
|
512 | (1) |
|
|
513 | (10) |
|
|
514 | (1) |
|
Structure of the LED Custom Control Example Code |
|
|
515 | (1) |
|
The Properties of the LED Control |
|
|
516 | (3) |
|
The Initialization Code of the LED Control |
|
|
519 | (4) |
|
Other Ways to Create a Custom Control |
|
|
523 | (1) |
|
|
523 | (2) |
|
Chapter 16 Appendix A: References |
|
|
525 | (26) |
|
|
525 | (1) |
|
|
525 | (1) |
|
|
525 | (1) |
|
|
526 | (1) |
|
|
526 | (1) |
|
|
526 | (1) |
|
|
527 | (1) |
|
|
527 | (1) |
|
JavaFX 2.x Builder Classes |
|
|
527 | (1) |
|
|
527 | (1) |
|
|
528 | (1) |
|
|
529 | (1) |
|
|
529 | (1) |
|
|
530 | (1) |
|
|
530 | (1) |
|
Enterprise GUI Frameworks |
|
|
531 | (1) |
|
Domain-Specific Languages |
|
|
532 | (1) |
|
|
532 | (3) |
|
Operating System Style Guidelines |
|
|
535 | (1) |
|
|
535 | (1) |
|
|
536 | (1) |
|
|
537 | (1) |
|
|
538 | (1) |
|
Java IoT and JavaFX Embedded |
|
|
539 | (1) |
|
Software and Device Manufacturers |
|
|
540 | (1) |
|
|
540 | (1) |
|
|
541 | (2) |
|
Java/JavaFX Books and Magazines |
|
|
543 | (1) |
|
|
544 | (1) |
|
Tutorials, Courses, Consulting Firms, and Demos |
|
|
544 | (1) |
|
Tools, Applications, and Libraries |
|
|
545 | (2) |
|
Videos and Presentations on JavaFX |
|
|
547 | (4) |
Index |
|
551 | |